We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d370d2b commit 35393b3Copy full SHA for 35393b3
WordPressUtils/src/main/java/org/wordpress/android/util/ServiceUtils.java
@@ -0,0 +1,16 @@
1
+package org.wordpress.android.util;
2
+
3
+import android.app.ActivityManager;
4
+import android.content.Context;
5
6
+public class ServiceUtils {
7
+ public static boolean isServiceRunning(Context context, Class<?> serviceClass) {
8
+ ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
9
+ for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
10
+ if (serviceClass.getName().equals(service.service.getClassName())) {
11
+ return true;
12
+ }
13
14
+ return false;
15
16
+}
0 commit comments