Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
private boolean isServiceRunning() {
ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
boolean isRunning = false;
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (LocationService.class.getName().equals(service.service.getClassName())) {
isRunning = true;
Timber.d("isRunning=%b", isRunning);
return isRunning;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment