I am adding a Notification to System bar using the NotificationCompat
library. This Notification has two action buttons. Also, AutoCancel()
property on the Notification is set to true.
On Click of the action buttons, System is configured to launch an IntentService
which calls NotificationManager.cancel(NOTIFICATION_ID)
and then launches an Activity in a New Task.
Problem is that though this call removes the notification from the tray, it does not collapse the drawer. The called Activity is drawn behind the drawer.
Can someone please shed some light on what special code is need to close the draw apart from canceling the notification?
First, press-and-hold on the persistent notification you want to remove. Another option is to swipe the notification left or right, and then tap on the cogwheel icon shown next to it. Next, tap on the switch next to Permanent to disable it, and then press Save.
If your action is in the form of a broadcast or a service but you intend for the notification drawer to collapse, you should broadcast android.intent.action.CLOSE_SYSTEM_DIALOGS from your onReceive. This will manually close the drawer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With