Closed Cornholio2108 closed 4 years ago
Method changed. Testing needed.
Might be helpful:
public static void stopService(Context context, Service s) {
Intent i = new Intent(context, s.getClass());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
s.stopForeground(Service.STOP_FOREGROUND_DETACH);
s.stopForeground(Service.STOP_FOREGROUND_REMOVE);
} else {
s.stopForeground(true);
}
context.stopService(i);
}
Service stopped properly now. Notification stays but can be deleted manually.
Notification isn't canceled after smart shutdown is lifted. AlarmManager should have set intent for shutdown lifted time.