Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tianyeeee/3b3656e37191de9dfcf788a7cb11361e to your computer and use it in GitHub Desktop.
Save tianyeeee/3b3656e37191de9dfcf788a7cb11361e to your computer and use it in GitHub Desktop.
private boolean isServiceRunning() {
ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)){
if("com.example.MyNeatoIntentService".equals(service.service.getClassName())) {
return true;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment