Hi!

Not sure if this is what you are looking for but you can get a list of
all running services by using:

ActivityManager am =
(ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningServiceInfo> runningServices =
am.getRunningServices(1000);

then just loop through that list to see if your service is running i.e

count = runningServices.size();
Component cnMyService = new ComponentName(this, myService.class);
(for int i=0; i < count ; i++) {
   if( runningServices.get(i).service.equals(cnMyService) )  {
      // Your service is running, do something
   }
}

Hope this helps!

//Erik

On 23 Apr, 05:45, ming ming <yangm...@gmail.com> wrote:
> I like to check my service status, e.g. live or be killed.
> so, I hope there is a command like "ps -ef " of linux.
>
> Thanks,
> Ming Ming
>
> --
> 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 
> athttp://groups.google.com/group/android-developers?hl=en

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