2011-09-16 20 views

Respuesta

73

Prueba esto puede ser útil para u

private boolean isMyServiceRunning() { 
    ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); 
    for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { 
     if ("com.example.MyService".equals(service.service.getClassName())) { 
      return true; 
     } 
    } 
    return false; 
} 
+0

Esto es lo que necesitaba, gracias! – Maurice

+0

cómo detener el servicio si se está ejecutando ... – Kishore

+1

@Kishore este mismo tema aquí http://stackoverflow.com/questions/2176375/android-service-wont-stop –

Cuestiones relacionadas