How to clear the Resumable audio notification

64 Views Asked by At

My app plays audio, there is a requirement that in certain cases, the app should not allow the audio get played. However the newer Android versions would create a card in the notification tray for the audio media whenever it is played, which is not created by our app. The result is that the users can play the audio from that card in the situation when the app is not supposed to play it. Is there a way to cancel that card? I tried to call

notificationManager.cancelAll()

and also called

stopForeground(Service.STOP_FOREGROUND_REMOVE)

when stopping the audio service, but none of that works.

0

There are 0 best solutions below