How do we know if a service has stopped in a bound and unbound service?
I want to check constantly if a service has stopped and what is its state/status?
Thanks
Sneha
How do we know if a service has stopped in a bound and unbound service?
I want to check constantly if a service has stopped and what is its state/status?
Thanks
Sneha
try this :
public boolean isServiceRunning(String serviceName) {
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
List<RunningServiceInfo> infos = manager.getRunningServices(30);
for (RunningServiceInfo info : infos) {
if (info.service.getClassName().equals(serviceName)) {
return true;
}
}
return false;
}