I’m writing a widget that pulls data from a web page every 5 minutes, using a timer. This works fine for an hour or two, then the process is killed.
I/ActivityManager(81): No longer want bellander.android.widget (pid 1118): hidden #16
and the system kills of the process. How do I prevent this? Is the use of a timer wrong?
Please use
AlarmManagerfor this. Do not attempt to have a service (or, worse, anAppWidgetProvider) live forever.Also, please make the period configurable and disable-able. Just because you want five-minute-polling does not mean your users always will.