Persist in database PendingIntent extracted from within a Notification

115 views Asked by At

Right now I have an app which is capturing all the notifications sent by other apps using the NotificationListenerService.

I managed to persist in a database the title, date, etc, but I wonder what's the best way to persist the PendingIntent that can be acquired with:

override fun onNotificationPosted(statusBarNotification: StatusBarNotification) {
    val pendingIntent = statusBarNotification.notification.contentIntent
}

My goal is to be able to persist that intent in a database in a way that I can later retrieve all notifications and when the user clicks in any of it then the original intent is fired.

0

There are 0 answers