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

3 comments

  • GoPromotional Products I registered a listener, so that I can handle the adding of the item to the wish list in on notification background action 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.

    Comment actions Permalink
    0
  • Locksmith Training  I registered a listener, so that I can handle the adding of the item to the wish list in on notification background action 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.

    Comment actions Permalink
    0
  • Great question—passing arguments into custom notification actions can definitely streamline UX if done right. It kind of reminds me of onboarding flows in other industries, like how trading platforms simplify their setup for new users. For instance, I recently looked into how to open an account with Exness, and they’ve really optimized the process to be beginner-friendly while still covering all compliance bases. If anyone's interested, here's a breakdown of that flow: how to open account with exness. Always cool to see how different platforms handle user actions and onboarding with a mix of clarity and control.

    Comment actions Permalink
    0

Please sign in to leave a comment.