I'm assuming that the variable you change to true and false is for whether
the service is currently running?  If so, you could create a second variable
in shared preferences called lastRunSuccessful.  When you start your service
you set it to false.  When you finish your service you set it to true.

That way, if your service is killed you can check these values to determine
the state of your service the next time you launch your app:

running && !lastRunSuccessful = service was killed
!running && lastRunSuccessful = service was not killed and was successful

If my logic is right the other states should never happen... but you may
want to check them and do something just in case.

Hope that helps...
Justin

On Fri, Feb 18, 2011 at 7:11 AM, Apoorva Moghey <
[email protected]> wrote:

> Hi,
>
> I m developing an application where when service start it mark flag
> true in shared preferences.And when it finishes its work it change
> flag to false. But suppose when someone kill whole process tree of
> application using android task manager. Service onDestroy () is not
> called where i were change the flag to false. So i m not able get
> state of service when application start. I want know is there any way
> to know when service is killed from task manager so that i can perform
> some action based on that.
>
> Thanks
> Apoorva Moghey
>
> --
> 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

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