How to get notification Id on time of notification recieved

I need push notification Id on time of notification received on AirshipReceiver Class, but in ArishipReceiver Class notification Id can access in onNotificationOpened(Context context, NotificationInfo notificationInfo) override method using NotificationInfo.getNotificationId  not in onPushReceived(Context context, PushMessage message, boolean notificationPosted) override method.


How can I get notification Id on time of notification received on AirshipReceiver Class.



Didn't find what you were looking for?

New post



  • Shailesh,

    Could you describe a little more of your use case why you would need to access the Notification Id? Keep in mind, the Notification Id is not the same as the Push Id.

  • Hi Michael Halka,

    I have implement option in my app that when any activity of app is open and that time a notification received by app then a dialog will pop up with two button that is Ok and View.

    When user click on Ok button then dialog will dismiss and nothing will perform and when user click on View button then dialog will dismiss and action will perform according to notification.

    On both case notification will remain in notification bar. Now I want in the case of click on View button, notification should also cancel for notification bar. For remove particular notification from notification bar, I need notification Id to remove that notification using below code.

    NotificationManager nMgr = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);


  • Shailesh,

    You might wish to reconsider that use case.

    We typically recommend against showing any kind of dialog to the user when a push is received while the app is open. The reason being is because this is a disruptive user experience and may actually end up making the user uninstall the app because it is so intrusive.

    What you might instead consider using is our [in-app messaging]( solution.

    In-app messages work very similar to banner messages on iOS and Android, and instead of having a modal dialog box that requires user input, it simply displays a small banner in either the top or bottom portion of the app, and goes away automatically if the user does not interact with it. 

    The great part, too, is that the deeplinking capabilities can be made such that they mirror the deeplinking of the actual push that appears when the app is backgrounded (When you're on the home screen of the device).

    So, again, try to move towards using in-app messaging instead to deliver the message to the user if they're inside the app, and move away from using a modal dialog box that disrupts the user experience.


Please sign in to leave a comment.