Thanks Mark,
I have that sample application from a previous query, I'll take another
look.
Regards,
Simon
On 05/06/2011 2:38 PM, Mark Murphy wrote:
On Sun, Jun 5, 2011 at 9:27 AM, Simon Platten
<[email protected]> 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
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en