Background threads, eg. for synchronization?
I'm storing user entered information locally on the phone first, then uploading / synchronizing with the website. This allows me to provide offline data entry, to be sync'd once web access is available.
I'd like to drop the info to be sync'd on a synchronization queue of some sort (currently just stored as Ti.App.Properties), and have a background thread pick up the data and sync it.
What are good strategies for background threads/work, for example to provide synchronization?
1 Answer
-
You could use the httpclient for this.
It's async, so it does not block the app while performing what you need.You might want to add some "buffering" mechanism in case your user changes some data while the sync is in progress, and of course a timestamp to your data( but i think you already have this :) ).