Open Sagar-Khenat opened 3 years ago
I was getting this same error so I decided to uninstall and reinstall FCM. When you did did you notice this error:
Installing "cordova-plugin-fcm-with-dependecy-updated" for android Plugin doesn't support this project's cordova version. cordova: 8.1.1, failed version requirement: >=9.0.0 Skipping 'cordova-plugin-fcm-with-dependecy-updated' for android Installing "cordova-plugin-fcm-with-dependecy-updated" for ios Plugin doesn't support this project's cordova version. cordova: 8.1.1, failed version requirement: >=9.0.0 Skipping 'cordova-plugin-fcm-with-dependecy-updated' for ios Adding cordova-plugin-fcm-with-dependecy-updated to package.json
You forgot platform ready declare platform in the constructor
this.platform.ready().then(() => {
this.fcm.getToken().then(token => {
// Save token
})
.catch(e => console.log('ErrorGetTocken', e))
})
.catch(e => console.log('ErrorInitFCM', e))
I was getting this same error so I decided to uninstall and reinstall FCM. When you did did you notice this error:
Installing "cordova-plugin-fcm-with-dependecy-updated" for android Plugin doesn't support this project's cordova version. cordova: 8.1.1, failed version requirement: >=9.0.0 Skipping 'cordova-plugin-fcm-with-dependecy-updated' for android Installing "cordova-plugin-fcm-with-dependecy-updated" for ios Plugin doesn't support this project's cordova version. cordova: 8.1.1, failed version requirement: >=9.0.0 Skipping 'cordova-plugin-fcm-with-dependecy-updated' for ios Adding cordova-plugin-fcm-with-dependecy-updated to package.json
Please update the plugin version. The minimum cordova
version was lowered to 8.1.0
.
I'm facing the same error @Sagar-Khenat did you resolved?
Hi @andrehtissot , I have been using the latest version of your plugin for our android app ( Version 7.6.0 ) . I used the similar method specified in readme file for importing the plugin: import { FCM } from "cordova-plugin-fcm-with-dependecy-updated/ionic/v4";
constructor( private fcm: FCM ) {
}
And my method call was: async getToken() { var token, permission; console.log('Inside getToken method:::'); if (this.platform.is('android')) {
token = await this.fcm.getToken().then( fcm_token => { console.log(fcm_token); });
} console.log("getToken :: ", token); this.localStorage.setObj('pushToken',token);
}
After building and running on my device, I am getting error message as TypeError: Cannot read property 'getToken' of undefined. My projects specifications include: "cordova": "^9.0.0", "cordova-android": "9.0.0", and I have built this project using targetsdkversion as 29, which is now required for play store. Please let me know if I should use current version or previous released versions and how should I call the getToken() method. Any kind of help will be really helpful as the cordova-plugin-firebase does not work for cordova-android 9.