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

怎甘沉沦 提交于 2019-12-07 04:59:13

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/26513967/how-do-i-add-a-variable-to-a-phonegap-plugin-with-meteor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!