Monday, December 20, 2010

[android-developers] Re: Prevent an Android Service from getting destroyed after an unbind

Thank you for the reply.

I should have made it more explicit in my question earlier. The delivery of the message (with the best possible geo-location) in Step 5 is of paramount importance in my application. In fact the very reason why the service S is a location listener is because I want to resend the message as soon as it gets a more accurate location fix or if the user location changes. This should be totally automatic.

So, the moment the message is delivered to S in Step 3, I should totally ensure that the service does not die without delivering the message. Of course, in the event of an action that causes the service to be forcefully killed (as you stated from the Settings or switch off the device) then we just ignore the message (although there are ways to deal with that as well).

Right now, I will try each of these alternatives post back how it goes:
1. use startService() & bindService() from A and use stopSelf() inside S once the message is delivered with the best location fix.
2. make it a foreground service with some kind of notification alerting the user that the message wasn't sent yet. In this case, I might have to provide a mechanism for the user to cancel all existing messages.

Sincere Regards,
Kalyan

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment