Bear
Bear

Reputation: 5152

Regularly Download something from database over the Internet in background

I am developing an android app. I want the program Regularly Download something from database over the Internet in background.

Should I use AlarmManager to trigger the BroadcastReceiver to download data from database?

Or there is other better method? Please give me some keywords to google if there is. Thank You.

Upvotes: 0

Views: 278

Answers (2)

NullPointerException
NullPointerException

Reputation: 37681

You should implement a Service that download the data from internet periodically with a thread.

You should have a "Application" class or something to access the DB of your app on the service, and then update all the data.

Services run in background mode.

Upvotes: 0

kabuko
kabuko

Reputation: 36302

BroadcastReceiver is supposed to be pretty short lived, so you're better off starting up a Service to download, but using the AlarmManager to trigger the whole process is probably the way to go.

Upvotes: 1

Related Questions