If you absolutely need it to be running all the time, you need to
acquire a PARTIAL_WAKE_LOCK via PowerManager.  This will keep the CPU
on all the time, and your program running.  Be prepared for a shocking
decline in battery life.

I assume your next question will be "How do I make it run as soon as
the phone boots?"  For that, you'll need to implement a
BroadcastReceiver that catches android.intent.action.BOOT_COMPLETED.
Your receiver would then launch your service.  Once the service
starts, you get the wakelock described above, and voila - you're
always running.

BTW, you'll need to declare permissions for both of those things.
Good luck!

Todd Sjolander

On Jun 30, 7:34 am, "M.Manjunatha" <[email protected]> wrote:
> Hi,
>
> How do I make my service always alive?? If my service gets killed
> because of an exception or if the VM kills my service on low memory,
> How do I make sure that my service is always running?
--~--~---------~--~----~------------~-------~--~----~
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