cordova-plugin-fcm-with-dependecy-updated: onNotification not fired with ionic3 on Android and iOS
Hello, I have an ionic3 app. I currently use cordova-plugin-fcm-ng, but have issues on android since i used cordova-android 8.1.0 (with 8.0.0 it was working fine) On the official ionic doc, it mentionned your plugin cordova-plugin-fcm-with-dependecy-updated, so i try to use it, but have mistakes too.
Simply create a new ionic3 project, add plugin, and little code to test, and, i see that getToken works well, but onNotification doesn’t work on IOS.
On Android, it’s ok on differents device and android version, but the icon is sometime white in status bar, sometime white in the detail card.
Steps to reproduce :
ionic start --type=ionic-angular --cordova
choose tabs template
ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated@6.4.3
npm install --save @ionic-native/fcm@4.20
Add FCM in app.module.ts
In home.htm, just add :
<p (click)="test()">
TEST FCM
</p>
in home.ts just add :
public test() {
this.fcm.getToken().then((token: string) => {
if (token !== undefined) {
console.log(token)
alert(token)
return token;
}
})
this.fcm.onNotification().subscribe((data) => {
if (data.wasTapped) {
alert("is tapped")
} else {
alert("not tapped")
}
});
Edit config.xml to put good id, working with your google-services.json
Build env : cordova-cli 9.0.0 node 12.13.0 npm 6.12.0
cordova-android 8.1.0 cordova-ios 5.1.1
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 22 (10 by maintainers)
Well, you have to give more details …
Just to conclude if it helps someone else :
Don’t put in AndroidManifest firebase deactivation, in my case, i delete this in my config.xml (i put before for RGPD with my previous fcm plugin which uses firebase-analytics) :
And be sure to use
this.fcm.requestPushPermission();
for iOS to enable Notif Push.For white icons, i’ll look later with this new version of plugin, and will open an issue if necessary