Search code examples
push-notificationphonegap-buildforward

Phonegap Push Notification redirect to specific page in the application when clicking


Using Phonegap Push Notifications Plugin to build a mobile application for IOS and Android, how proceed to let the notification received redirect or forward to a specific page in the application when the user clicked it? i.e. when receiving the notification, the user must open it to see it, we need to forward the application to a specific page, like notifications.html?id=USER_ID?

Is that any way to send the parameter USER_ID with the message pushed , The issue could be resolved in this case...

Thank you for your suggestions...


Solution

  • When you sent a push notification from your server includes an extra value name id.

    When the notification is received then save the value of this "extra value" id using localStorage.setItem.

    then inside onresume event reads the value of this id using localStorage.getItem, and according the value open the respective page using $.mobile.changePage( ...);

    for detail check this :

    https://github.com/phonegap-build/PushPlugin/issues/213