chemerisuk / cordova-plugin-firebase-config

Cordova plugin for Firebase Remote Config

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Demo project

Hitman666 opened this issue · comments

Hi Maksim,

Thanks for investing the time in making this plugin.

Could you possibly create a demo app and outline the steps that need to be done in order to get this actually working? Like, how do we setup the GoogleService-Info.plist file - is it needed?

I'm asking because I added the plugin to my demo Ionic project, set GoogleService-Info.plist in the root folder, and used:

if (window.cordova && window.cordova.plugins.firebase.config) {
    cordova.plugins.firebase.config.update(8 * 3600).then(function() {
        alert("your config was updated");
    });
}

but I don't get an alert.

Any help is welcome, thank you!

@Hitman666 have you tried to use console.log instead of alert?

@chemerisuk yes, I have - that doesn't make any difference.

I managed to add the 'defaults' Plist file and link to it from the config and I get a default value by using this:

cordova.plugins.firebase.config.getString('some-key').then(function(value) {
    console.log(value);
})

However, I'm getting this error in the Xcode logs:

NSURLConnection finished with error - code -1100

I googled and presumed it's something to do with https (while fetching the remote config), but after adding the fix it's still the same.

Also, I tried fetching the error in the update like this:

cordova.plugins.firebase.config.update(5).then(function() {
    console.log("your config was updated");
}).catch(function(err) {
    console.log(JSON.stringify(err));
});

but I get no console logs for that.

So, I would honestly really appreciate it if you could possibly give more info of how to actually set up this project. Meaning, do I have to install Firebase in some way? A demo project would really be immensely helpful.

I know how it is to maintain a plugin (I wrote 4 of them for Ionic/Cordova), and I volunteer to write a blog post after that and promote this plugin on my blog.

Anyways, yeah, feeling truly stuck :/

@Hitman666 the install is typical - just add GoogleService-Info.plist file into Resources.

Well, behind the scenes I set devMode flag if config ttl is zero. Try code below:

cordova.plugins.firebase.config.update(0).then(function() {
    console.log("your config was updated");
}).catch(function(err) {
    console.log(JSON.stringify(err));
});

Thanks for your answer, but this doesn't help.

I do get the Starting Firebase Remote Config plugin output, but then after I try to fetch any value, I'm always getting the one from default local config file.

I even tried this on a fresh blank Ionic template project.

If you could put together a demo example that works, that would really help.

Thank you!

Just pinging if there's an update on this?

Thank you!

@Hitman666 sorry, I have no idea. It should just work

Could you please create a demo project using your plugin that showcases its working?

I cannot get it to work either.
Then method: cordova.plugins.firebase.config.update throws an error with the value null.

@cmartin81 Check your adb logcat. Probably, you tried to run your app on an emulator and got Google Play Services Not Found error in console. Emulators don't have them installed, thus the null error.

@Hitman666 - I've had issues with the other of these Firebase plugins where there is no plugins object attached to the global Cordova object, so 'window.cordova.plugins.firebase.config' is always going to be false/undefined, hence why your alert doesn't fire. Even after 'deviceReady' the object is never initialized