While everything Brian suggests will work (I built a similar tool 
here: https://github.com/bmeike/StrangeLoop/tree/master/SafeAsyncTask), I'd 
really suggest that there is a far better architecture, probably using an 
IntentService.  Wrap your task parameters as an Intent and fire them off at 
the Service.  The service runs the task and returns a result using a 
PendingIntent.  There's some code here that hints at how to do 
it: 
https://github.com/bmeike/AnDevConIV/blob/master/src/net/callmeike/android/enterprise/svc

Activities are ephemeral.  If you have a task that is so important that it 
is worth making it waste battery, even when no-one is watching (which is 
what a persistent AT does), it makes sense to put it somewhere less 
ephemeral: a Service.

G. Blake Meike
Marakana

Programming Android 2ed is now in stores:
http://bit.ly/programmingandroid

-- 
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

Reply via email to