Sei sulla pagina 1di 1

4/24/2018 intentservice - Android how to check if the intent service is still running or has stopped running - Stack Overflow

Stack Overflow is a community of 8.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ×

Android how to check if the intent service is still running or has stopped running Ask Question

I need to know if all intentservices in the queue are "consumed" or the other way is to find out if it is still doing something so that I don't continue until all
services have stopped running. Any ideas?

android intentservice

asked Sep 16 '11 at 5:27


Maurice
3,656 12 43 74

1 Answer

Try this may be useful for 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;
}

edited Oct 31 '11 at 6:40 answered Sep 16 '11 at 6:43


Parag Chauhan
24.9k 12 76 94

This is what I needed, thanks! – Maurice Sep 16 '11 at 7:07

how to to stop the service if it is running... – Kishore Mar 14 '12 at 7:33

1 @Kishore this same topic here stackoverflow.com/questions/2176375/android-service-wont-stop – Parag Chauhan


Mar 14 '12 at 7:43

8 I dont think this works for intentServices... – superUser May 18 '16 at 15:13

It's also working for intent service. thanks. – HourGlass Jun 15 '16 at 11:07

https://stackoverflow.com/questions/7440473/android-how-to-check-if-the-intent-service-is-still-running-or-has-stopped-runni/7441063 1/1

Potrebbero piacerti anche