While working on a new feature for our app, I needed to add notifications. Copy and paste being developer’s best friends, I duly copy/pasted notifications for some other feature and went about adjusting the code. The plan was to display notifications as ongoing for a while so that they can’t be dismissed and then remove the ongoing flag to convert them to dismissible notifications. Everything worked without a hitch, except for the minor detail - Clear button in the notification shade which usually dismisses all notifications (bar ongoing ones) was not clearing these notifications. I could manually dismiss, but Clear would not remove them. After commenting out everything that could be commented out, after looking (in vain) into documentation, a thought occurred that too much may have been removed. Looking at the other feature’s notifications code I noticed that they are grouped.
And sure enough, after a group was assigned to notifications, Clear started working again.
This was not reproduced in sample app. However, in production app the issue and solution were real and reproducible. Possible explanation could be that in production app notifications transition thru several stages, while sample app was simpler.
What’s depressing here is that these things are not documented. Maybe this is explained somewhere, but after checking many notifications related pages in the docs, I was unable to find the rationale for the observed behavior.