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.

>From your explanation above, it seems that AlarmManager will do the
job for me too.

thanks
aayush

On 5/29/09, Mark Murphy <[email protected]> wrote:
>
>> If I create a no-gui application that extends and android.app.Service
>> 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?
>
> 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
> something.
>
> 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)
> http://commonsware.com
> _The Busy Coder's Guide to Android Development_ Version 2.0 Available!
>
>
>
> >
>


-- 
aayush
----------------------------------------------------
"Cleverly disguised as a responsible adult"

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