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. no classfiles specified and Conversion to Dalvik format failed with error 1

Hi Guys,

I have a working(Released) project that needs some updating. The
Project was created with SDK 1.1 on Windows and Ecplise 3.4.
A couple months ago i moved away from Windows to Mac and installed all
tools on the mac including Android SDK 1.1. Everything was working
fine at that time.

I never bothered compiling the project against SDK 1.5 as the program
was running fine on a 1.5 Device.
But now i need to do some changes and installed SDK 1.5, following the
installation guideline (

So I build my project against  SDK 1.1 (as suggested) and failed with
the following error messages :
- no classfiles specified
- Conversion to Dalvik format failed with error 1

I receive the same error if I compile with SDK 1.5 (clean + build).

First i thought there is something wrong with my code but could not
find anything.
After that I tried the example JetBoy and received the same error.
Using "Fix Project Properties" was without effect for booth projects.

I am kind of clueless right know and happy for any suggestion


2. Set the theme from the application: the background doesn't change

You can only set the theme during creation.  To apply a theme, the entire UI
need to be reinflated and rebuilt from its resources.

On Thu, May 21, 2009 at 6:01 PM, <

Dianne Hackborn
Android framework engineer

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.


3. Video Capturing

4. Beta App Test Group

5. What DB do you use in android flatform?

6. How to put buttons in a row?

7. are the clinet(testset), pv engine , pv framework, pv node, pv logger in the same thread