Android 我想在通知单击时打开我的应用程序的特定页面。(Ionic2)

Android 我想在通知单击时打开我的应用程序的特定页面。(Ionic2),android,firebase,ionic-framework,ionic2,firebase-cloud-messaging,Android,Firebase,Ionic Framework,Ionic2,Firebase Cloud Messaging,考虑一下这个场景。我有一个ionic2应用程序,我正在使用FCM插件进行推送通知。现在让我们假设推送通知在应用程序处于后台时到达。用户,在应用程序抽屉中查看通知,然后单击通知以获取更多信息。我希望用户使用这个.nav.push(PushPage)导航到特定路径。如何点击通知点击事件 应用程序组件.ts import { Component,ViewChild } from '@angular/core'; import { Platform,NavController,AlertControll

考虑一下这个场景。我有一个ionic2应用程序,我正在使用FCM插件进行推送通知。现在让我们假设推送通知在应用程序处于后台时到达。用户,在应用程序抽屉中查看通知,然后单击通知以获取更多信息。我希望用户使用这个.nav.push(PushPage)导航到特定路径。如何点击通知点击事件

应用程序组件.ts

import { Component,ViewChild } from '@angular/core';
import { Platform,NavController,AlertController } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { FCM } from '@ionic-native/fcm';


import { HomePage } from '../pages/home/home';
import {PushPage} from '../pages/push/push';
declare var FCMPlugin;
@Component({
templateUrl: 'app.html',
providers :[FCM]

})
export class MyApp {
 rootPage:any = HomePage;
 @ViewChild(NavController) nav;

constructor(platform: Platform, statusBar: StatusBar, splashScreen: 
 SplashScreen,private fcm: FCM,
 private alertCtrl: AlertController) {
   platform.ready().then(() => {
   statusBar.styleDefault();
   splashScreen.hide();

   fcm.subscribeToTopic('marketing');
   fcm.getToken().then(token=>{

  })

   fcm.onNotification().subscribe(data=>{
    if(data.wasTapped){
     console.log("Received in background");
     this.nav.push(PushPage); 
   } else {
       console.log("Received in foreground");
       this.nav.push(PushPage);
   };
 })

  fcm.onTokenRefresh().subscribe(token=>{
    this.nav.push(PushPage);
 })
  fcm.unsubscribeFromTopic('marketing');

   });

 }

}

我解决了我的问题。我在这里学习并应用了这个例子