Reputation: 150
I'm developing a simple tracking application. This application sends current location and time to a remote server every 30 seconds. I've used android-priority-jobqueue and Retrofit, so if no notwork is available the app enqueues these data and send them when a network's available. If the app works offline for you say 1 hour after getting online, it calls my webapi 120 times. is there any out of box solution to combine these jobs in one or replace my api call jobs in android-priority-jobqueue with one job containing all past one hour data so the data is sent in one webapi call? I mean some event that raises before run jobs in the queue and a way to access all jobs in the queue to replace them with a new one
Upvotes: -1
Views: 318
Reputation: 4617
One way to solve this problem is to have repository or cache to store locations, and schedule Single Instance Jobs every 30 seconds, which just clear out repo/cache and send all locations at once.
Upvotes: 0