配置 Cordova 项目(config.xml)

Meteor 在构建期间读取应用程序目录根目录中的 mobile-config.js 文件,并使用其中指定的设置生成 Cordova 的 config.xml

Project_folder
 ├── /.meteor
 └── mobile-config.js

大多数配置都可以通过 mobile-config.js(应用程序元数据,首选项,图标和启动屏幕以及 Cordova 插件安装参数)实现。

App.info({
  id: 'com.example.matt.uber',
  name: 'Uber',
  description: 'Get Uber power in one button click',
  author: 'Matt Development Group',
  email: 'contact@example.com',
  website: 'http://example.com'
});

// Set up resources such as icons and launch screens.
App.icons({
  'iphone': 'icons/icon-60.png',
  'iphone_2x': 'icons/icon-60@2x.png',
  // ... more screen sizes and platforms ...
});

App.launchScreens({
  'iphone': 'splash/Default~iphone.png',
  'iphone_2x': 'splash/Default@2x~iphone.png',
  // ... more screen sizes and platforms ...
});

// Set PhoneGap/Cordova preferences
App.setPreference('BackgroundColor', '0xff0000ff');
App.setPreference('HideKeyboardFormAccessoryBar', true);
App.setPreference('Orientation', 'default');
App.setPreference('Orientation', 'all', 'ios');

// Pass preferences for a particular PhoneGap/Cordova plugin
App.configurePlugin('com.phonegap.plugins.facebookconnect', {
  APP_ID: '1234567890',
  API_KEY: 'supersecretapikey'
});

不要手动编辑/.meteor/local/cordova-build/config.xml 文件,因为它会在每个 meteor run ios/androidmeteor build 重新生成,因此你将丢失所有修改。

参考页面: 流星指南>构建>移动>配置你的应用程序