Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo project #3

Open
NikolaBreznjak opened this issue Apr 24, 2018 · 10 comments
Open

Demo project #3

NikolaBreznjak opened this issue Apr 24, 2018 · 10 comments

Comments

@NikolaBreznjak
Copy link

NikolaBreznjak commented Apr 24, 2018

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!

@chemerisuk
Copy link
Owner

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

@NikolaBreznjak
Copy link
Author

@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 :/

@chemerisuk
Copy link
Owner

@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));
});

@NikolaBreznjak
Copy link
Author

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!

@NikolaBreznjak
Copy link
Author

Just pinging if there's an update on this?

Thank you!

@chemerisuk
Copy link
Owner

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

@NikolaBreznjak
Copy link
Author

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

@cmartin81
Copy link

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

@chun-baoluo
Copy link

chun-baoluo commented Nov 29, 2018

@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.

@willnix86
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants