Hi, I'm having lot of issues trying to make this plugin works in android.
I created an app in Google Firebase, I downloaded the google-services.json and I placed it into the root folder, I installed the plugin, I ran the app (in the simulator) and then when I run this command:
window.FirebasePlugin.getToken(function(token) {
alert(token);
}, function(error){
alert('Error!!!');
});
I just got a blank alert.
What am I doing wrong?
Your emulator needs some extra setup to support push notifications. Try running the app on your phone and see if it works.
if your token is blank, try reinstall your plugin with GitHub url
cordova plugin add https://github.com/arnesson/cordova-plugin-firebase
I found the same problem with this plugin under ionic2 and with the @kirajhpang solution works correctly, thanks!!!
I have the same problem on android (not ios) . plugin version : 0.1.24. The google-services.json is well in platforms/android folder. I've already try to reinstall plugin with GitHub url but without success :(
@Makaveli17 do you receive token recently but suddenly blank?
I received with the FCM-plugin but i changed to firebase-plugin because i had a conflict between FCM plugin and goople-plus plugin.
At start I had a problem with the google-services.json to 0 octet in platform/android so I copied directely the right file in, but no more success. (sorry for my english and thanks you for the help)
Thank you, @kirajhpang!
@kirajhpang very helpful, thanks a lot.
closing for now, reopen if still an issue with the latest version of the plugin
Hi guys, i've installed cordova-plugin-firebase plugin 0.1.25 yesterday.
I did exactly what the documentation says, when i run the getToken: in the success handler, the token equals an empty string. :-(
Android: Oreo (8.0), Xiaomi Mi A1
cordvoa version: 8
@omeriko version 0.1.25 is broken and we are still waiting for a new release (https://github.com/arnesson/cordova-plugin-firebase/issues/625)
Ok,
Meanwhile which version is recommend to the community for use?
BTW, there is a fix in one of the issue trackers: copying the app_id, and app_key from google-services.json to strings.xml, it works for me. It's a good idea to mention it in the installation documentation of version 0.1.25, at least until the new version comes out.
I'm getting this only with an android emulator using the 1.0.4 version of the plugin.
On real hardware the token is returned just fine.
Most helpful comment
if your token is blank, try reinstall your plugin with GitHub url
cordova plugin add https://github.com/arnesson/cordova-plugin-firebase