Reputation: 794
I am developing a web crawler using Android. Currently my crawler crawls the web using asynctask every time the app starts, which takes a long time.
I want my app to update its database daily in the background, without needing to launch the MainActivity interface. After doing some research, I found the following classes can help me:
Can someone shed some light for me, I'm new to Android programming. Thanks
Upvotes: 1
Views: 2484
Reputation: 76
Below are some ways that you can go about doing job scheduling:
You can schedule it to run every X hours with other params like run when internet comes, battery should be above critical level. Check them out and make a decision according to your requirements.
Upvotes: 1
Reputation: 10215
You should read this chapter: https://developer.android.com/training/best-background.html
You need an alarm manager to run the service every hour. You also need to receive a broadcast when the device reboots to start the alarm manager...
This can also help you: Alarm Manager Example
Upvotes: 1