How-to start service automatically on system startup and on installation

by Dianne Hackborn » Tue, 14 Apr 2009 07:33:07 GMT


Sponsored Links
 To amplify -- just starting your service at boot and leaving it running all
of the time is NOT recommended.  It consumes a lot of resources, if nothing
else a whole process sitting there doing nothing (presumably) most of the
time, when that memory could be used for other things.







-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

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.

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. "singleTask" really always at the root of activity stack?

Ah the problem is that you want to put singleTask on what you have
-published- as your main activity, which is the splash screen.  This is the
thing that the use launches from home.  What has happened is:
1. Splash screen launched into its own task.
2. Main activity launched into its own task.
3. Splash screen exits.
4. User launches app again, which is the splash screen activity.
5. The splash screen activity has the same task affinity is the currently
running main activity, so the system brings the current main activity to the
foreground and launches the splash screen on top of it.

So make your splash screen singleTask instead of the "main" activity which
is really inside of your app's task flow, and all should be fine.

(Or don't use singleTask at all.  Is there a reason you are using?  Very few
apps actually do want it, and unless your app is designed to be launched by
other apps in special ways, there is almost certainly no reason to use it at
all.)










-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

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.

--~--~---------~--~----~------------~-------~--~----~

2. will the device wake up if there is a widget instance on the homepage but the widget provider or receiver is disabled?

Diane,
Perhaps I got my question wrong. But the following url

http://developer.android.com/guide/topics/appwidgets/index.html

indicates that

""Note: If the device is asleep when it is time for an update (as
defined by updatePeriodMillis), then the device will wake up in order
to perform the update. ...."

This is based on 1.5.

Thanks again
Satya






--~--~---------~--~----~------------~-------~--~----~

3. connect to Google maps API or app to trace routes ...

4. Like to look at space?

5. About XML

6. medial calculators and reference

7. 1.6 SDK - OpenGL