Skip to content

Commit

Permalink
fix #2437: clear uploading posts state if the PostUploadService is no…
Browse files Browse the repository at this point in the history
…t running during PostList creation
  • Loading branch information
maxme committed Mar 19, 2015
1 parent 682b62b commit 1d171d8
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.wordpress.android.util;

import android.app.ActivityManager;
import android.content.Context;

public class ServiceUtils {
public static boolean isServiceRunning(Context context, Class<?> serviceClass) {
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (serviceClass.getName().equals(service.service.getClassName())) {
return true;
}
}
return false;
}
}

0 comments on commit 1d171d8

Please sign in to comment.