# How to open a specific page when a push notification is clicked in Ionic while app is in background?

**URL:** <https://forum.ionicframework.com/t/how-to-open-a-specific-page-when-a-push-notification-is-clicked-in-ionic-while-app-is-in-background/110275>\
**Category:** ionic-v3\
**Created:** [October 28, 2017, 8:13am UTC](https://forum.ionicframework.com/t/how-to-open-a-specific-page-when-a-push-notification-is-clicked-in-ionic-while-app-is-in-background/110275 "2017-10-28T08:13:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![z\_apps](https://avatars.discourse-cdn.com/v4/letter/z/a698b9/32.png) [@z\_apps](https://forum.ionicframework.com/u/z_apps)\
**Post date:** [October 28, 2017, 8:13am UTC](https://forum.ionicframework.com/t/how-to-open-a-specific-page-when-a-push-notification-is-clicked-in-ionic-while-app-is-in-background/110275/1 "2017-10-28T08:13:57Z")

</div>

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.

> **[Push Notifications in Ionic – Ankush Aggarwal – Medium](https://medium.com/@ankushaggarwal/push-notifications-in-ionic-2-658461108c59)**
>
> Updated to Ionic 3

Here is my code

```auto

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) => {
      console.log('device token -> ' + data.registrationId);
      //TODO - send device token to server
    });

    pushObject.on('notification').subscribe((data: any) => {
      console.log('message -> ' + 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: () => {
              //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 => console.error('Error with Push plugin' + error));
  }

```

---

<div class="post-metadata">

**Author:** ![mcihak](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mcihak/32/104211_2.png) [@mcihak](https://forum.ionicframework.com/u/mcihak)\
**Post date:** [November 29, 2017, 7:44am UTC](https://forum.ionicframework.com/t/how-to-open-a-specific-page-when-a-push-notification-is-clicked-in-ionic-while-app-is-in-background/110275/2 "2017-11-29T07:44:29Z")

</div>

Hi,  
did you found solution for this?

---

<div class="post-metadata">

**Author:** ![StrongLucky](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@StrongLucky](https://forum.ionicframework.com/u/StrongLucky)\
**Post date:** [March 5, 2018, 11:59am UTC](https://forum.ionicframework.com/t/how-to-open-a-specific-page-when-a-push-notification-is-clicked-in-ionic-while-app-is-in-background/110275/3 "2018-03-05T11:59:43Z")

</div>

I need this solution too 🙂

---

<div class="post-metadata">

**Author:** ![watermelon91](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/watermelon91/32/119008_2.png) [@watermelon91](https://forum.ionicframework.com/u/watermelon91)\
**Post date:** [April 25, 2018, 4:22pm UTC](https://forum.ionicframework.com/t/how-to-open-a-specific-page-when-a-push-notification-is-clicked-in-ionic-while-app-is-in-background/110275/4 "2018-04-25T16:22:47Z")

</div>

Hello,  
did you found solution for this?

---

<div class="post-metadata">

**Author:** ![ebeliejinfren](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ebeliejinfren/32/123635_2.png) [@ebeliejinfren](https://forum.ionicframework.com/u/ebeliejinfren)\
**Post date:** [April 25, 2018, 10:18pm UTC](https://forum.ionicframework.com/t/how-to-open-a-specific-page-when-a-push-notification-is-clicked-in-ionic-while-app-is-in-background/110275/5 "2018-04-25T22:18:10Z")

</div>

i need too  
thanks 🙏
