I'll like to ask if it's possible to check a service is running from Broadcast receiver.
I know that it's possible in Activity.
Thanks for your precious help
I'll like to ask if it's possible to check a service is running from Broadcast receiver.
I know that it's possible in Activity.
Thanks for your precious help
yes' it's possible to detect if service is running from anywhere you have available Context object:
private boolean isMyServiceRunning(Context context) {
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
    if (MyService.class.getName().equals(service.service.getClassName())) {
        return true;
    }
}
return false;
}
MyService  is your service class.