In ActivityManager there's a getRunningServices call.

However, someone will likely soon appear on this thread to say that
you shouldn't use it
because 'that's not the intended use'.

Shortly after, someone else will chip in with 'maybe the fact that
your having difficulty with this
tells you that Android wasn't really designed for this type of thing'.

Pent

p.s. I can confirm the call is not reliable, I ended up having to use
a static flag.

On Sep 7, 4:51 am, sunny <menon1...@gmail.com> wrote:
> Dear Folks,
> I have a service that is running within the context of my application. It
> gets invoked at the start of the activity and then gets update when new data
> is inserted or deleted from the database. The problem is that everytime I
> start the activity , it restarts the service. As you may have guessed  - not
> a very intuitive design. Therefore I was wondering if there is a way to
> determine if the service is already running before starting it. I know I can
> bind to the service but I do not want that since the main activity needs to
> exits after the database operation is completed.
>
> I know for system services, you can get the service details from the
> application context. How do you do it for user defined service?
>
> thanks for all help here.
>
> regards
> Sunny.

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

Reply via email to