What is the best practice to run two or more services consistently?
For example:
REST service retrive some data and if there is some new stuff download service should be ran?
I’m sending broadcast to receiver after first is finished, and receiver grabs data from intent and send it to second service.
You could as well send an
Intentfrom theRestServicedirectly to theDownloadServicewithout putting theBroadcastReceiverbetween the two of them.I think
IntentServicewill be a better aproach for yourDownloadService.EDIT: forgot to mention that since
API Level 9Android has aDownloadManagerclass that handles your downloads, retries them after failures, connectivity changes, etc.