There is no need to use a service for this. Why do you want a service? If your application is in the foreground, then you know it is running, so you don't need a service to keep it running.
On Tue, Jul 10, 2012 at 10:14 PM, NayAnesh Gupte <nayanesh.gu...@gmail.com>wrote: > Hello all, > > I want to run a background thread or service till application is in > foreground. Means i want that service to run in background only if any > activity of an application is in foreground and visible. > when application is in background or not running i.e no activity is in > foreground or visible it should stop service or cancel that background > thread. > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- 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. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en