How to pass an argument to custom notification actions?

I want to create a custom notification action, for example "add to wishlist" which should be triggered in the background. Clicking on it should add the item to wishlist without opening the app.

I registered a listener, so that I can handle the adding of the item to the wishlist in onNotificationBackgroundAction but I wasn't able to retrieve any information about the current item (item_id). When I create a message, I also cannot find anything about that.

Can you please help? Thanks

airship.pushManager.notificationListener = (object : NotificationListener {
override fun onNotificationDismissed(notificationInfo: NotificationInfo) {


}

override fun onNotificationBackgroundAction(
notificationInfo: NotificationInfo,
actionButtonInfo: NotificationActionButtonInfo
) {
// add the item to the wishlist
return
}

override fun onNotificationForegroundAction(
notificationInfo: NotificationInfo,
actionButtonInfo: NotificationActionButtonInfo
): Boolean {
return false
}

override fun onNotificationOpened(notificationInfo: NotificationInfo): Boolean {
return false
}

override fun onNotificationPosted(notificationInfo: NotificationInfo) {

}
})

 

Didn't find what you were looking for?

New post

Comments

0 comments

Please sign in to leave a comment.