Transcript
Page 1: Infinum Android Talks #05 - Square tape

Square TapeIvan Kocijan

Page 2: Infinum Android Talks #05 - Square tape

What is the problem?• Application is uploading files on our server

but Internet connection is gone or the phone is suddenly turned off !

What to do? • Can we continue? • Where to continue? • How to save our progress?

Page 3: Infinum Android Talks #05 - Square tape

Using Square tape• Collection of queue-related classes for

Android and Java • File-based FIFO. • Created by Square, Inc.

Page 4: Infinum Android Talks #05 - Square tape

What do you need• Add it to build.gradle

compile 'com.squareup:tape:1.2.+' • Create 4 java classes and 1 interface:

1. GsonConverter 2. TapeCallback 3. Tape task 4. TapeTaskQueue 5. TapeService

Page 5: Infinum Android Talks #05 - Square tape

GsonConverter• Convert objects to and from JSON so that

they can be written on disk in human readable format

Page 6: Infinum Android Talks #05 - Square tape

TapeCallback• Interface which we will use to indicate that

task is successfully finished and can be removed from Queue

Page 7: Infinum Android Talks #05 - Square tape

TapeTask• Task which will be added to Queue for

execution

Page 8: Infinum Android Talks #05 - Square tape

TapeTaskQueue• Queue which holds our tasks • It will take care of serialization and

deserialization of our tasks

Page 9: Infinum Android Talks #05 - Square tape

TapeService• It will start when there are tasks in our

Queue and end when Queue is empty or there was an error

Page 10: Infinum Android Talks #05 - Square tape

Find out more• http://square.github.io/tape/

Page 11: Infinum Android Talks #05 - Square tape

Questions?

?


Top Related