Hi I installed cordova-plugin-fcm by using below command
cordova plugin add cordova-plugin-fcm
npm install --save @ionic-native/fcm
imported the FCm from
and added FCM provider to app.module.ts
import { FCM } from ‘@ionic-native/fcm’;
constructor(private fcm: FCM) {}
this.fcm.getToken().then(token => {
console.log("fcm token is "+token);
});
So console prints empty for token so please help me am using android@6.2.3
this is my code, good luck
this.fcm.getToken()
this.fcm.receive.subscribe(() => {
console.log("token ", this.fcm.device_token);
})
this.fcm.listenToNotifications().pipe(
tap(msg => {
//show toast in app
})
)
.subscribe();
Thanks for your reply.
But it is showing these two below errors
Property ‘receive’ does not exist on type ‘FCM’.
Property 'device_token does not exist on type ‘FCM’.

in your fcm
public device_token: String;
async getToekn() {
let token;
if (this.platform.is('android')) {
token = await this.firebaseNative.getToken();
this.device = 'Android'
}
if (this.platform.is('ios')) {
token = await this.firebaseNative.getToken();
await this.firebaseNative.grantPermission();
this.device = 'iOS'
}
this.device_token = token
console.log("your device token is ", token);
return this.saveTokenToFirestore()
}
receive is an observable I created to handle the async function