views:

98

answers:

1

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?

+1  A: 

I'm writing a widget that pulls data from a web page every 5 minutes, using a timer

Please use AlarmManager for this. Do not attempt to have a service (or, worse, an AppWidgetProvider) 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.

CommonsWare
I have worked around the AlarmManager because all examples/docs I could find were so crappy (though I have not looked at yours). But now, after some trail and error, I have got it to work and it is really simple! I cant believe the docs are so bad for something this simple.. I think I have to write an example widget using the AlarmManager.. Thanks for the help!
Johan B