public static boolean isServiceRunning ( Class < ? extends Service > service ) { ActivityManager manager = ( ActivityManager ) QuickUtils . getContext ( ) . getSystemService ( Context . ACTIVITY_SERVICE ) ; for ( ActivityManager . RunningServiceInfo runningServiceInfo : manager . getRunningServices ( Integer . MAX_VALUE ) ) { if ( service . getName ( ) . equals ( runningServiceInfo . service . getClassName ( ) ) ) { return true ; } } return false ; }
Is this service running?