title: How to open a specific page when a push notification is clicked in Ionic 3 while app is in background?
body: <p>I have integrated PhoneGap push notifications plugin. I am able to receive notifications in Android and i am able to open a specific page when app is in the foreground. I would like to open a specific page when a user clicks on the notifications while app is in background but I am not able to find any solutions. I even tried the link below.</p>
  
  <p><a href="https://medium.com/@ankushaggarwal/push-notifications-in-ionic-2-658461108c59" rel="nofollow noreferrer">https://medium.com/@ankushaggarwal/push-notifications-in-ionic-2-658461108c59</a></p>
  
  <p>Here is my code</p>
  
  <pre><code>initPushNotification() {
      if (!this.platform.is('cordova')) {
        console.warn('Push notifications not initialized. Cordova is not available - Run in physical device');
        return;
      }
      const options: PushOptions = {
        android: {
          senderID: 'YOUR_SENDER_ID'
        },
        ios: {
          alert: 'true',
          badge: false,
          sound: 'true'
        },
        windows: {}
      };
      const pushObject: PushObject = this.push.init(options);
  
      pushObject.on('registration').subscribe((data: any) =&gt; {
        console.log('device token -&gt; ' + data.registrationId);
        //TODO - send device token to server
      });
  
      pushObject.on('notification').subscribe((data: any) =&gt; {
        console.log('message -&gt; ' + data.message);
        //if user using app and push notification comes
        if (data.additionalData.foreground) {
          // if application open, show popup
          let confirmAlert = this.alertCtrl.create({
            title: 'New Notification',
            message: data.message,
            buttons: [{
              text: 'Ignore',
              role: 'cancel'
            }, {
              text: 'View',
              handler: () =&gt; {
                //TODO: Your logic here
                this.nav.push(DetailsPage, { message: data.message });
              }
            }]
          });
          confirmAlert.present();
        } else {
          //if user NOT using app and push notification comes
          //TODO: Your logic on click of push notification directly
          this.nav.push(DetailsPage, { message: data.message });
          console.log('Push notification clicked');
        }
      });
  
      pushObject.on('error').subscribe(error =&gt; console.error('Error with Push plugin' + error));
    }
  </code></pre>