Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a variable to a phonegap plugin with Meteor?

I have a plugin, https://github.com/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin, that I would like to use with Meteor. I added the GIT repo to app/.meteor/cordova-plugins.

The plugin requires a variable to be passed to it when it's installed. How would I add that variable?

I added this to mobile-config.js:

// Pass preferences for a particular PhoneGap/Cordova plugin
App.configurePlugin('nl.x-services.plugins.launchmyapp', {
  URL_SCHEME: 'mycoolapp'
});
App.setPreference("URL_SCHEME", "mycoolapp");

I am still getting the error that states that the variable URL_SCHEME is missing.

like image 795
DigiLord Avatar asked Oct 22 '14 17:10

DigiLord


1 Answers

I will post a complete answer in case someone stumbles on it.

From Meteor Phonegap documentation:

Some Cordova/Phonegap plugins, such as the "Facebook Connect" plugin, require build-time variables such as an APP_ID or APP_NAME. To include these variables in your Cordova/Phonegap build, set them up in your Mobile Configuration file (starting from 0.9.4). (https://github.com/meteor/meteor/wiki/Meteor-Cordova-Phonegap-integration#cordova-plugins-configuration)

So if you look at the example, here is a way to do it in your app's mobile-config.js file:

App.configurePlugin('org.apache.my-plugin', { variable: 'value' });

like image 66
imslavko Avatar answered Oct 10 '22 20:10

imslavko