I am displaying notification with following code:
val notification = NotificationCompat.Builder(this, AudioNotificationHandler.CHANNEL_ID)
.setContentTitle("abc")
.setSmallIcon(
R.drawable.ic_certyylogo
)
.setStyle(
androidx.media.app.NotificationCompat.MediaStyle()
.setMediaSession(mediaSession.sessionToken)
.setCancelButtonIntent(
PendingIntent.getBroadcast(
this,
23,
Intent("abc"),
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)
)
.setShowCancelButton(true)
)
.setOngoing(true)
.setDeleteIntent(
PendingIntent.getBroadcast(
this,
23,
Intent("abc"),
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)
)
.build()
notification.flags = Notification.FLAG_NO_CLEAR
(this.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).notify(
34,
notification
)
If the onGoing flag is set to false: The notification can be swiped to dismiss if the player is in paused state and corresponding delete event is fired.
If the onGoing flag is set to true: The notification can still be swiped to dismiss if the player is in paused state but the corresponding event is not fired.
Am I doing something wrong? How to get event to be fired when the notification is swiped away when onGoingFlag is set to true??