Ionic 2 push payload - How to use payload in component


I’m sending a push notification with Firebase and it works. When I send a payload with the push notification how is possible to read the data from the payload in the component.

When I alert the msg object from the observable it alerts [object, Object]

Here is the code that subscribes to the push notification

  .subscribe((msg) => {
    alert(msg.title + ': ' + msg.text);

    if ( || {
      // The app is being opened from a notification
      alert("OPEN APP");
      this.rootPage = RetailPage;
    } else {
      // The app was already open when the notification was received
      alert("APP WAS OPEN");

Your system information:

ordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.46
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.7.0
Xcode version: Not installed

Any help appreciated

Best regards


Is this possible, any help appreciated please :slight_smile:
Thanks in advance


Did you ever figure out how to do this? I’m stuck on the same problem. Thanks :slight_smile:


@swarley @markmtrl I think that is the normal behaviour, not only for alerts, but anything that prints an object as a string. Differently than console.log, if you want any useful information about the object in the alert, the best way is either use the values explicitly (like in your first alert), or, even better, call alert(JSON.stringify(msg)).

If you can see the console logs, logging the message with console.log(msg) would be the best solution IMO, but I don’t know if that is the case for you.


Thank you, this worked perfectly:)


hello i have problem for redirecting on notification receive , when i tap on notification it open app only but not redirect i am using ionic 2


well i solve by comparing the title then navigate to the component. e.g at your push service just send the page title instead of the “page” it self.