Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 离子罐';不保存PushToken_Android_Ionic Framework_Push Notification_Ionic2_Firebase Cloud Messaging - Fatal编程技术网

Android 离子罐';不保存PushToken

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

我正在尝试按照本教程向我的应用程序添加推送通知。当应用程序在我的手机上运行时,它会在没有启动的情况下崩溃。从chrome inspector我得到了以下错误消息。

这是我的密码。 app.module.ts:

    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中
离子状态重置
有效吗?