【发布时间】:2018-03-08 05:33:56
【问题描述】:
点击通知时如何转到特定页面? 我使用 Firebase 控制台推送通知 我是这样用的。但它没有工作
fcm.onNotification().subscribe(data=>{
if(data.wasTapped){
this.navcntrl.push(MessagePage);
};
})
我怎样才能正确地做到这一点?
我的完整代码:app.component.ts
export class MyApp {
@ViewChild(Nav) nav: Nav;
rootPage: any = HomePage;
pages: Array<{title: string, component: any}>;
constructor(public platform: Platform,private fcm: FCM, public statusBar: StatusBar, public splashScreen: SplashScreen) {
fcm.onNotification().subscribe(data=>{
this.nav.push(ListPage)
})
this.initializeApp();
this.pages = [
{ title: 'Home', component: HomePage },
{ title: 'List', component: ListPage }
];
}
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
});
}
openPage(page) {
this.nav.setRoot(page.component);
}
}
提前致谢
【问题讨论】:
-
请帮帮我,很紧急
标签: ionic-framework ionic3 cordova-plugin-fcm