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

Configure without using preferences #62

Closed
rooswelt opened this issue Aug 23, 2016 · 1 comment
Closed

Configure without using preferences #62

rooswelt opened this issue Aug 23, 2016 · 1 comment

Comments

@rooswelt
Copy link

For test/production purpose I need to switch application between test and production server.
I do this in my code in only one point but with the plugin I must change also preferences.

Is it possible to configure plugin (i.e. parse-server address, gcm parameters and so on) on javascript instead of config.xml?

Thanks

@taivo
Copy link
Owner

taivo commented Aug 23, 2016

The parameters you mentioned can't be configured solely from javascript due to the cold start cases. When notification arrives and your app is not running, the native side of Cordova gets woken up first. It's expected to handle the notification message well before the javascript side of Cordova is initialized.

That's how Cordova works, AFAIK. Because of that, if we don't have access to those parameters (via config.xml) and initialize the Parse Platform on the native side before handling Parse notifications, the app will crash.

That said, there is something you can quickly do to achieve the same "modify parameter at only 1 place" effect. Use the config.xml parameters in addition to a gulp task. This task should watch for changes in config.xml and replace a string like var MY_SERVER = "blah blah" with var MY_SERVER = "real-server-url" in the relevant javascript file.

@taivo taivo closed this as completed Aug 23, 2016
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

2 participants