|
|
|
@ -30,6 +30,10 @@ public class MicroPhotoContext {
|
|
|
|
|
|
|
|
|
|
public static final String PACKAGE_NAME_MPAPP = "com.xypower.mpapp";
|
|
|
|
|
public static final String PACKAGE_NAME_MPMASTER = "com.xypower.mpmaster";
|
|
|
|
|
|
|
|
|
|
public static final String SERVICE_NAME_MPSERVICE = PACKAGE_NAME_MPAPP + ".MicroPhotoService";
|
|
|
|
|
|
|
|
|
|
public static final String SERVICE_NAME_MPMASTER = PACKAGE_NAME_MPMASTER + ".MpMasterService";
|
|
|
|
|
public static final String ACTION_HEARTBEAT_MP = "com.xypower.mpapp.ACT_HB";
|
|
|
|
|
public static final String ACTION_RESTART_MP = "com.xypower.mpapp.ACT_RESTART";
|
|
|
|
|
public static final String ACTION_UPDATE_CONFIGS_MP = "com.xypower.mpapp.ACT_UPD_CFG";
|
|
|
|
@ -141,13 +145,13 @@ public class MicroPhotoContext {
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static boolean isAppAlive(Context context, String packageName) {
|
|
|
|
|
public static boolean isAppAlive(Context context, String packageName, String serviceClassName) {
|
|
|
|
|
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
|
|
|
|
List<ActivityManager.RunningServiceInfo> services = am.getRunningServices(Integer.MAX_VALUE);
|
|
|
|
|
|
|
|
|
|
boolean isRunning = false;
|
|
|
|
|
for (ActivityManager.RunningServiceInfo rsi : services) {
|
|
|
|
|
if (packageName.equalsIgnoreCase(rsi.service.getPackageName())) {
|
|
|
|
|
if (packageName.equalsIgnoreCase(rsi.service.getPackageName()) && TextUtils.equals(serviceClassName, rsi.service.getClassName())) {
|
|
|
|
|
isRunning = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|