Hi!
first of all thanks for this plugin!
the getToken method is returning an empty sting but the plugin is working fine with notifications. Also onTokenRefresh is not working (it is never fired).
So notifications are working but token methods are not working.
Utilities.logOnScreen simply print on device screen the message (only for my comfort)
Thank you in advance!
Cordova 6.4.0
IDE NetBeans 8.2
OS: Xubuntu 16.04
Tested on Virtual Devices:
`
onDeviceReady: function () {
this.receivedEvent('deviceready');
window.FirebasePlugin.onTokenRefresh(function (token) {
Utilities.logOnScreen('onTokenRefresh ' + token);
}, function (error) {
Utilities.logOnScreen('onTokenRefresh: ' + error);
});
jQuery("#getToken").click(function () {
window.FirebasePlugin.getToken(function (token) {
Utilities.logOnScreen('getToken ' + token);
console.log("token: " + token);
}, function (error) {
Utilities.logOnScreen('getToken error: ' + error);
});
});
window.FirebasePlugin.onNotificationOpen(function (notification) {
Utilities.logOnScreen('wasTapped ' + JSON.stringify(notification));
}, function (error) {
Utilities.logOnScreen('else ' + JSON.stringify(error));
});
}
`
I did have the same problem,
mi solution was to fix the config.xml of the proyect changing the name of the <widget id="same proyect name at firebase">, rm and re add the platform and validate that the google-services.json was not empty at the platform/android/
@shepax Hi, I did not understand your answer, you can put the code fragment where the change is made. Thank you very much for your help
This was the solution
Download your Firebase configuration files, GoogleService-Info.plist for ios and google-services.json for android, and place them in the root folder of your cordova project:
I need to add those two files to the project and with that they return the tokens correctly
I am still having this issue. Updating google-services.json didn't work. @robertarnesson ?
@VesperDev sorry for the bad exp,
When you build a project at firebase you have to define the iOS bundle ID or Android bundle ID, that bundle have to be the same that you have defined at the config.xml of the ionic or cordoba project
<widget id="bundle id">
Hi,
I have the same issue. I placed the fcm config file in root folder and my widget id is same.
still its getting empty token.
I am having the same issue, yesterday I was receiving the token correctly but today I am getting empty string. maybe the server is down because it is not possible to access to my project in firebase console
anyone fix this? I have exactly same problem - and the bundle id and package name I have in Firebase is definitely equal to the value of widget id!
Same Problem!
Need a fix urgently
The problem is still there... any update on this issue !?
Another solution is here: https://github.com/arnesson/cordova-plugin-firebase/issues/558
To the author: A PR and a fix is URGENT now... ;-)
closing this for now. the more recent problems are not related. see #558 for android 7 issues
Most helpful comment
This was the solution
Download your Firebase configuration files, GoogleService-Info.plist for ios and google-services.json for android, and place them in the root folder of your cordova project:
platforms/
plugins/
www/
config.xml
google-services.json <--
GoogleService-Info.plist <--
I need to add those two files to the project and with that they return the tokens correctly