Square has an open source project name Tape http://square.github.io/tape/ that implements a persistent file backed queue. All of the examples seem to indicate that objects can be added to the queue from the main thread. However, every other best practice for android seems to indicate that doing I/O on the main thread is just playing chicken with ANRs.
Is the Square Tape file backed queue designed to be used from the main thread? If so, what makes it reliably safe to used from the main thread without the fear of an ANR vs any other form of I/O?
If you take a look inside the examples on http://square.github.io/tape/ , basically you should use a service within a thread on each Task inherited class for do the job, since Task has the concept of something that could be executed.
If you want, you could do some explorations with HandlerThread, AsyncTask or even Executors and test which of those fits better upon your needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With