ActivityManager am =
(ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
List
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
   } 
data from:http://groups.google.com.tw/group/android-developers/browse_thread/thread/9d3a18d966a320cd
 
沒有留言:
張貼留言