On Tue, Jun 22, 2010 at 6:14 PM, vineet <[email protected]> wrote:
> what i wanted is if not possible service to stop when activity ends
> (or back button is pressed) the service should continue in
> background..

Your Activity can call startService() on the Service. If you do not
call stopService(), the Service will keep running. It will not keep
running indefinitely, though. You can use startForeground() in your
Service to try to keep running longer, though this is designed for
things the user started and directly cares about (e.g., a music
player) and has some requirements (e.g., a Notification). However, you
absolutely positively do not want to design an application that
assumes a Service will run forever.

If your goal is to do something on a periodic basis -- what you might
use a Windows "Scheduled Task" for -- look at AlarmManager.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

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