Ionic 3 + Android +推送通知=找不到类

时间:2018-08-01 20:04:15

标签: android ionic-framework push-notification ionic3

我找不到类,只是在android中,IOS正常工作,有人已经遇到了这个问题吗?

我已经排除了android平台,然后再放一次,它没有解决,已经尝试了另一个项目,也没有解决..

我总是遇到Android问题,IOS总是问题,一切都变得更容易...但是我也需要android ..

我的config.xml

 plugin name="phonegap-plugin-push" spec="^ 2.1.3">
             <variable name="FCM_VERSION" value="11.6.2" />
            <variable name="SENDER_ID" value="42116867643" />
         </ plugin>
    <platform name="android">
    <resource-file src="google-services.json" target = "application/ google-services.json" />
    </ platform>

我的.ts文件

console.log('hasPermission - before');

this.push.hasPermission().then((res: any) => {
    console.log('hasPermission - after', res);
    ...
}).catch(error => {
    console.log('hasPermission - error ', error );
    throw error; //-> here i got the error 'CLASS NOT FOUND'
});
```

```
  setTokenPush(){
    const options: PushOptions = {
      android: {
        senderID: '42116867643'
      },
      ios: {
        alert: 'true',
        badge: true,
        sound: 'true'
      },
      windows: {},
      browser: {
        pushServiceURL: 'http://push.api.phonegap.com/v1/push'
      }
    };

    const pushObject: PushObject = this.push.init(options);
    pushObject.on('notification').subscribe((notification: any) => {
      let ethereumStr: string = notification.additionalData.data; // get the string
      let data: { datas: string } = JSON.parse(ethereumStr);
      this.response = data;
      this.data_ethereum =  this.response.datas.ethereum;
      this.data_bitcoin =  this.response.datas.bitcoin;
      this.data_litecoin =  this.response.datas.litecoin;
      this.storage.set('data_ethereum', this.data_ethereum);
      this.storage.set('data_litecoin', this.data_litecoin );
      this.storage.set('data_bitcoin', this.data_bitcoin); 
      this.navCtrl.push(LoadingPage,{  
        "message_loading":notification.title,
        "type":"receive",
      });


    });
    pushObject.on('registration').subscribe((registration: any) => {

      this.configPushUser(registration.registrationId);

    });

    pushObject.on('error').subscribe(error => {
    });

  }
  configPushUser(token){
    this.webservice.configPushUser(token).subscribe(data=>{

    });

  }

0 个答案:

没有答案