FCM getToken() returns empty string

I’m Using ionic-native fcm for notifications.
When doing getToken() i’m getting back empty string and the onTokenRefresh() never gets called…
these are my methods:

this.fcm.getToken().then(token => {
      alert('token id: ' + token);      

    this.fcm.onTokenRefresh().subscribe(token => {
      alert('token id onTokenRefresh: ' + token);

What am i missing?


1 Like

have you installed plugin and native/fcm correctly?

and check whaether you added google-services.json into project folder and everthing in it correct eg package name matching,api key etc

installed plugin and native/fcm correctly?
yes, as instructed in the official docs.


package name matching,api key

What else can cause this?

uninstall app and try running

cordova run android --prod

sometimes it wont take changes made --prod will make it happen

well good news, now i’m getting null (-:
so this has to do with the fact that the onTokenRefresh doesn’t fire?

I have the same problem. Have you been able to solve it?

Same problem here. Any news?

for testing purpose create an project in FCM and try to establish connection with FCM.
If it is working fine then u could change your FCM server key with the new one.

yes, dropped FCM , working with ionic native push