Android 离子罐';不保存PushToken
我正在尝试按照本教程向我的应用程序添加推送通知。当应用程序在我的手机上运行时,它会在没有启动的情况下崩溃。从chrome inspector我得到了以下错误消息。 这是我的密码。 app.module.ts:Android 离子罐';不保存PushToken,android,ionic-framework,push-notification,ionic2,firebase-cloud-messaging,Android,Ionic Framework,Push Notification,Ionic2,Firebase Cloud Messaging,我正在尝试按照本教程向我的应用程序添加推送通知。当应用程序在我的手机上运行时,它会在没有启动的情况下崩溃。从chrome inspector我得到了以下错误消息。 这是我的密码。 app.module.ts: const cloudSettings: CloudSettings = { 'core': { 'app_id': '5186aaf6' }, 'push': { 'sender_id': '20589804805', 'pluginConf
const cloudSettings: CloudSettings = {
'core': {
'app_id': '5186aaf6'
},
'push': {
'sender_id': '20589804805',
'pluginConfig': {
'ios': {
'badge': true,
'sound': true
},
'android': {
'iconColor': '#343434'
}
}
}
};
@NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
IonicModule.forRoot(MyApp),
CloudModule.forRoot(cloudSettings)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}]
})
app.component.ts
export class MyApp {
rootPage = HomePage;
constructor(platform: Platform, public push: Push) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
StatusBar.styleDefault();
Splashscreen.hide();
});
alert("App Started");
this.push.register().then((t: PushToken) => {
return this.push.saveToken(t);
}).then((t: PushToken) => {
console.log('Token saved:', t.token);
});
this.push.rx.notification()
.subscribe((msg) => {
alert(msg.title + ': ' + msg.text);
});
}
}
我正在使用安卓设备测试应用程序。请帮我解决这个问题。谢谢。从警告中可以看出,没有一个插件安装正确。您是否安装了带有
--save
选项的插件?我使用save选项,包包含在package.json和config.xml中离子状态重置
有效吗?