The process gets killed and then gets recreated (typically 5 seconds later)
because of START_STICKY.

onDestroy does not get called, along with any other callbacks, the process
just goes away.

There is no duplicate instance of Service object.

This might help:

http://android-developers.blogspot.com/2010/02/service-api-changes-starting-with.html


And speaknig more broadly, "eternal services" is something that really
scares some users, the ones that use various system monitoring tools more
than all other apps combined, but they'll be the ones leaving one star
comments in Market.

-- K

2012/5/9 William Kelley <williamtkel...@gmail.com>

> I have a simple Android Activity with one button to start and stop a long
> running Android Service (which does some simple logging). As soon as I
> start the service, I close the app (Activity) and the service should then
> run in the background indefinitely.
>
> But it doesn't. At random times, the Application object this Service
> belongs to is recreated by the OS and then my Service is as well. So it's
> not just that the Service is getting onStartCommand called, but first it
> gets onCreate called, creating a new Service. I don't know what happens to
> the old one, it just goes away - onDestroy is not called or anything.
>
> I run the Service as START_STICKY, I am not using the main UI thread in
> any way, so there should be no issues there. I am Logging all activity from
> the Service, logging exceptions, etc. Nothing is out of the ordinary except
> that my Service is getting recreated over and over. I just can't understand
> what the problem is.
>
> The Service is running fine, then boom, my Application gets an onCreate,
> my Service gets an onCreate and onStartCommand and the old Service, which
> was in the middle of logging goes, away without any notice or warning. The
> new Service starts logging. I end up with a bunch of disconnected logs
> where there should be just one.
>
> --
> 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

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

Reply via email to