version:1.0

update:2021-10-13 18:52:13
fix:去除okgo,rxAndroid1,优化依赖
add:切换到奥乐云平台
This commit is contained in:
2021-10-13 18:54:20 +08:00
parent 13707fc96a
commit 3018660216
181 changed files with 2343 additions and 4445 deletions

View File

@@ -0,0 +1,38 @@
package com.aoleyun.sn.utils;
import android.app.ActivityManager;
import android.content.Context;
public class ServiceAliveUtils {
public static boolean isServiceAlive(Context mContext) {
boolean isServiceRunning = false;
ActivityManager manager =
(ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
if (manager == null) {
return false;
}
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (mContext.getClass().getName().equals(service.service.getClassName())) {
isServiceRunning = true;
}
}
Logutils.i("ServiceAliveUtils", mContext.getClass().getName() + "isServiceAlice: " + isServiceRunning);
return isServiceRunning;
}
public static boolean isServiceAlive(Context mContext, String serviceName) {
boolean isServiceRunning = false;
ActivityManager manager =
(ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
if (manager == null) {
return false;
}
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (serviceName.equals(service.service.getClassName())) {
isServiceRunning = true;
}
}
Logutils.i("ServiceAliveUtils", serviceName + " :isServiceAlice: " + isServiceRunning);
return isServiceRunning;
}
}