Skip to content

Commit 6a05144

Browse files
committed
Merge branch 'hotfix/3.8.1' into release/3.9
2 parents cec9c82 + 1d171d8 commit 6a05144

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)