Capturning Ionic push notifications in open app

In the final stretch of understanding/implementing Ionic2 push notifications.

Last stuck on GET showing my POST were all of status:locked, state:enqueued, and notifications NOT showing up on device and thinking notifications were not being sent.

Quickly learned that notifications WERE being sent, it was simply that my open app was not intercepting the notifications. (Notifications fly through predictably when app was CLOSED)

From picked up on:

Handling Notifications
To handle push notifications in your app, you need to subscribe to the notification observable.

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

However, I can’t get this to fire, can someone assist?

in app.ts I have:

platform.ready().then(() => {

  if ('mobileweb')) {
      this.devicePushToken = { id: '', registered: false, saved: false, token: '' };
  } else {
      console.log('Device UUID: ' + Device.device.uuid);
      let saveOptions = { ignore_user: true };
      this.push.register().then((t: PushToken) => {
          return this.push.saveToken(t, saveOptions);
      }).then((t: PushToken) => {
          this.devicePushToken = t;
          console.log('Token saved:', t.token);

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



1 Like

I implemented ionic 2 push notifications and also capturing in open app to show alert to ignore or view notification. I wrote a small tutorial to help others, see if below link is useful

The docs for this are confusing… I have mine as:

          this.push.register().then( (t: PushToken) => {
            return this.push.saveToken(t);
          }).then( (t: PushToken) => {
            console.log('Token saved:', t.token);
          }).catch( err => { console.log("register or save error", err);} );

            .subscribe( (msg) => { console.log(msg); this.mpapi.receiveNotification(msg);  });
          console.log('Logged in');

That is, the .rx call is outside the then() of the register() promise - this seems to work, for me.