(Notifications) Does anyone know what the behavior would be if a foreground service is showing a not...
z
(Notifications) Does anyone know what the behavior would be if a foreground service is showing a notification, and is then stopped after N time - but its notification is updated shortly after the stop call? - Would it dismiss the notification (as expected)? - Or, would the notification be updated, and stick around even though the service is destroyed?
😶 2
r
NotificationManager will immediately remove the notification attached to a foreground service when the service is destroyed
z
Thanks for the reply @Remy Benza. Thats the way I understood it to work as well, I cant 100% verify this but I feel like thats not always the case though (this happens 1/1000 of the time, approximately). If
notificationManager.notify
is invoked at just the wrong time, e.g. close to when the service is being destroyed, I suspect that a new notification is produced which sticks around even after the service is destroyed. Even using
notificationManager.cancel
in the services onDestroy doesnt cancel out this behavior. Since its so rare, I cant really verify this theory until enough people have used the workaround though, so I guess time will tell.