On Sun, Jun 5, 2011 at 9:27 AM, Simon Platten <simonaplat...@googlemail.com> wrote: > I think I may have fixed it, I looked around for some information on > BroadcastReciever 'onRecieve' routines. I suspected it was that I was > spending to much time in this routine, but I couldn't find anything to back > this up. > > What I have done now is to create a worker thread when the onRecieve is > called, this allows the onRecieve to return almost instantly and so far, > since doing this I haven't had any problems.
A manifest-registered BroadcastReceiver cannot safely fork threads. Once onReceive() is done, Android can terminate the process at any time, and it might well do that before your thread is finished. The typical pattern for a manifest-registered BroadcastReceiver that is doing any significant work is for it to call startService() on an IntentService, with the IntentService doing the "real work". If the alarm for your AlarmManager is a _WAKEUP alarm, you will also need to think about WakeLocks, perhaps using my WakefulIntentService or something else following that pattern: https://github.com/commonsguy/cwac-wakeful -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 3.0 Programming Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en