|
|
|
@ -162,6 +162,21 @@ public class MicroPhotoContext {
|
|
|
|
|
return isRunning;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int getProcessIdOfService(Context context, String packageName, String serviceClassName) {
|
|
|
|
|
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
|
|
|
|
List<ActivityManager.RunningServiceInfo> services = am.getRunningServices(Integer.MAX_VALUE);
|
|
|
|
|
|
|
|
|
|
int pid = 0;
|
|
|
|
|
for (ActivityManager.RunningServiceInfo rsi : services) {
|
|
|
|
|
if (packageName.equalsIgnoreCase(rsi.service.getPackageName()) && TextUtils.equals(serviceClassName, rsi.service.getClassName())) {
|
|
|
|
|
pid = rsi.pid;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return pid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String buildAppDir(Context contxt) {
|
|
|
|
|
|
|
|
|
|
String path = Environment.getExternalStorageDirectory().getAbsolutePath();
|
|
|
|
|