Starting services on Android Boot

by dapaintballer331 » Fri, 29 May 2009 02:30:33 GMT

Sponsored Links
 If I create a no-gui application that extends and
class, how do I get it to register itself so that the application
starts when the phone boots up?

I need some way to have it always launch when the phone is turned on,
how can I do this?

I know how to get a service to start & communicate with a real
application, but I can't get it to start when the phone boots.



Starting services on Android Boot

by HenrikH » Fri, 29 May 2009 03:35:12 GMT

 Add a BroadcastReceiver listening to BOOT_COMPLETED.



Sponsored Links

Starting services on Android Boot

by Mark Murphy » Fri, 29 May 2009 10:22:55 GMT

 > If I create a no-gui application that extends and

To repost my answer to a very similar question:

First, make sure this is really the architecture you want. Odds are, it's
not -- details later in this message.

To get control at boot time, you need to hold the RECEIVE_BOOT_COMPLETED
permission and register a BroadcastReceiver in your manifest that watches
for the BOOT_COMPLETED broadcast Intent. Then, you have five seconds to do

My strong recommendation is that you use AlarmManager to schedule yourself
to run like a cron job, so your code can execute every so often to do
something useful.

You could start a service directly instead. However, your service will
shortly thereafter stop running, because the device will go to sleep. And,
if you decide you'll hold a WakeLock and force the device to stay awake
forever and ever and ever, you'll drain the battery in no time flat. So,
you may as well design your app to only run so often, and then you can use
AlarmManager and be friendlier to your users.

Mark Murphy (a Commons Guy) 
_The Busy Coder's Guide to Android Development_ Version 2.0 Available!


Starting services on Android Boot

by aayush bhatnagar » Fri, 29 May 2009 10:31:11 GMT

 Hello Mark,
I am also designing an application which has similar uptime
requirements. It is a telephony client that needs to register with the
network on device bootup. After this, i listen for incoming requests,
or if the user decides to make a call, i initiate the same.
So, my application needs to stay alive for the entire duration the
device is up and running.

job for me too.


"Cleverly disguised as a responsible adult"


Other Threads

1. OMX source/sink and Tunnelling of processing components

i have 2 queries about Android framework.

1) Can we use OMX source and sink components instead of MIO components
for capturing / rendering ?
Does it have any impact on performance or conformance?

2) Is it feasible to achieve the "data tunneling" in Android framework
as supported by standard OMX components?
If yes can this tunnel include source/sink, processing components to
directly capture / render data ?
If this is not directly supported in the current framework, how can
this be achieved ?

thanks a lot,

2. How can ExpandableListActivity be customized?

What's the default layout ExpandableListActivity (ELA) uses? And what's the
id of the list that ELA uses?

I've looked at the APIDemos, and the 3 examples just work with the bundled
ExpandableListView and the bundled default layout.

Any pointers on how to customize/override is welcome.

take care,
Muthu Ramadoss. - mobile search. redefined. +91 98403 48914


3. Attaching debugger to emulator

4. Working example of CrossProcessCursor?

5. How to assign a hotkey to an application

6. Is there a "gdb" or "gdbserver" running on an Android ARM device?

7. Have you tried the "event send EV_KEY" command in android emulator console ??