I Can't get push token using fcm.getToken(). When testing app on real android device, it throws this error : plugin_not_installed.
I followed this documentation : https://ionicframework.com/docs/native/fcm
import { FCM } from '@awesome-cordova-plugins/fcm/ngx';
...
constructor(
private backend: BackendService,
private platform: Platform,
private fcm: FCM,
private ionCompService: IonComponentService
) { }
ngOnInit(): void {
this.platform.ready().then(() => {
this.fcm.getToken().then((token: string) => {
this.backend.setPushToken(token);
}, (err: any) => this.ionCompService.showErrorToast('setToken err : ' err));
});
}
There is my project packages :
"@angular/common": "^14.0.0",
"@angular/core": "^14.0.0",
"@angular/forms": "^14.0.0",
"@angular/platform-browser": "^14.0.0",
"@angular/platform-browser-dynamic": "^14.0.0",
"@angular/router": "^14.0.0",
"@awesome-cordova-plugins/calendar": "^5.45.0",
"@awesome-cordova-plugins/fcm": "^5.46.0",
"@capacitor/core": "4.3.0",
"@ionic-native/calendar": "^5.36.0",
"@ionic-native/native-storage": "^5.36.0",
"@ionic/angular": "^6.1.9",
"@ionic/cordova-builders": "^7.0.0",
"@ionic/storage-angular": "^3.0.6",
"bootstrap": "^5.2.1",
"cordova-android": "10.1.2",
"cordova-browser": "6.0.0",
"cordova-ios": "6.2.0",
"ionicons": "^6.0.3",
"rxjs": "~6.6.0",
"tslib": "^2.2.0",
"zone.js": "~0.11.4"
CodePudding user response:
I dropped this package... I use instead https://github.com/dpa99c/cordova-plugin-firebasex and it works fine.