Hello, I have a problem with Android (as always … in ANDROID), following I did an application using the ionic push system, with firebase. I’ll show you
IOS:
- I generated the
GoogleService-Info.plis
file and put it in my project
2.configured myxml
<platform name = "ios">
<resource-file src = "GoogleService-Info.plist" />
</ platform>
3.Created apple certificate.
4. Tested and ran completely.
5.all ok…
NOW ON ANDROID
- I generated the file google-services.json
2.configured the xml
<platform name = "android">
<resource-file src = "google-services.json" target = "application / google-services.json" />
</ platform>
3.configured xml with sender_id
<plugin name = "phonegap-plugin-push" spec = "^ 2.1.3">
<variable name = "FCM_VERSION" value = "11.6.2" />
<variable name = "SENDER_ID" value = "42116867643" />
</ plugin>
4. I gave the build and it just does not happen, it does not enter the metedos, I verify if it has permission it does not return anything at all …
My codes
it does not enter this hasPermission () method, only in IOS…
this.push.hasPermission()
.then((res: any) => {
if (res.isEnabled) {
alert("true");
} else {
alert("false")l
this.navCtrl.setRoot(NotificationPage);
this.updateDatas();
}
});
```
```
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=>{
});
}
```