Push service: subscription to push.rx.notification() continually emits same notification


#1

In the Ionic Push docs it states to use a similar snippet of code to this, which I have implemented in our mobile app:

this.push.rx.notification()
  .subscribe((msg) => {
    alert(msg.title + ': ' + msg.text);
  });

The only difference being that instead of alert I am using the Ionic toast to present it.

When a push notification is then pushed to the device running this code, it seems to infinitely present one toast after another. Anyone had this happen? Any thoughts why?


#2

The unsubscribe method is used when the application no longer wants to receive push notifications from a specific topic but continue to receive other push messages. Read this link https://github.com/ionic-team/ionic-native/pull/995/commits/34b74b84cb0ac6ed50c80bdf16423d3890d70e21#diff-43f23a51712aa1ec0834bb85ea7a7812