I'm sorry in advance for not having any code to post up, mainly because I can't for the life of me figure out how I need to do what I need to do.
Basically, at specified intervals during the day (ex. 5 P.M), I want my app to download some data from my server and store it on the device. This is to both reduce the load on my server from having data being downloaded every time the app is run, and to reduce the loading times for the user so that when they go to use the app, the latest data is already sitting on their device.
I have absolutely no clue how to do this. I know how to download data just fine, but now how to download in the background like I'm planning. Is it even possible?
I'm not asking for anyone to do it for me, but could someone please point me in the right direction.
AlarmManager, Service, AsyncTask, BroadcastReceiver
Write a Service.
Use the AlarmManager.
Use the AlarmManager
Use it to start a Service
The API Demos includes an Alarm Service example (in the "App" section), which:
In particular, see AlarmService.java for an example of using AlarmManager to schedule your Service to be woken later, and see AlarmService_Service.java for an example of how to respond to that alarm. The API Demo's AndroidManifest.xml contains the related service and activity definitions: