As of API level 21, getRunningAppProcesses() returns the app itself. How can I get the processes running in the android ?
As of API level 21, getRunningAppProcesses() returns the app itself. How can I get the processes running in the android ?
private boolean isMyServiceRunning(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;
}
Pass the class that you need to check