I want to implement push notification using ionic 3 and firebase. I am using cordova-plugin-fcm but I am getting the token as on getToken(). I have already setup the project on firebase and downloaded the google services. When I used this plugin a year back everything was working perfect. Now when I am using it on my new project I am getting null as token. Is the getToken() depredicated?? Please help me on this one. I have installed the fcm plugin as we as @ionic-native/fcm. According to the new documentation the plugin in now renamed as cordova-plugin-fcm-with-dependecy-updated, I have tried this too but the result is same. I cant use console as native plugin are already installed.Please help!!!
my component.ts
this.fcm.subscribeToTopic('all');
alert('here');
this.fcm.getToken().then(token => {
alert(token);
localStorage.setItem('token', token);
alert(token);
});
this.fcm.onNotification().subscribe(data =>{
alert('Your order as been assigned.Please reload the page')
if(data.wasTapped){
//alert('background');
} else {
//alert('foreground');
}
});
this.fcm.onTokenRefresh().subscribe(token => {
//alert('token')
});