After I killed the application (incl. foreground service) through the app settings, then the notification icon that is bind to the foreground service remains visible.
Is it possible to remove the icon after the application was killed?
After I killed the application (incl. foreground service) through the app settings, then the notification icon that is bind to the foreground service remains visible.
Is it possible to remove the icon after the application was killed?
Based on the answers here I found a solution (thx @Anubhav Gupta).
You can override the onTaskRemoved
function in which the foreground service can be stopped.
@Override
public void onTaskRemoved(Intent rootIntent) {
Intent intent = new Intent(this, MyService.class);
context.stopService(intent);
}