Skip to content

Commit 35393b3

Browse files
committed
fix #2437: clear uploading posts state if the PostUploadService is not running during PostList creation
1 parent d370d2b commit 35393b3

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)