Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
Component used:WorkManager Version used:2.4.0 Devices/Android versions reproduced on:Pixel 4
Hi, I am experimenting with the work manager API and stumbled upon an issue. First of all I used the snippet from the documentation herehttps://developer.android.com/topic/libraries/architecture/workmanager/advanced/long-running .
I changed it a little bit, so it looks like this:
The issue is that when the worker is done the notification is not cancelled and stays visible indefinitely. I tried looking at the library code to find out what I am doing wrong and found that some methods are called in the way that is basically not consistent with the requirement of canceling the notification. Specifically in the class SystemForegroundDispatcher the method onExecuted() is called after the method handleStop(). In the method onExecuted() we set mLastForegroundInfo field, and in handleStop() we check this field if it is not null and in this case cancel the notification. I don't know if it's really the issue or If am I doing something wrong, so I am asking if you could please check this issue.