Original: http://rensanning.iteye.com/blog/2019331
The first thing to note is that the Www/config.xml has been moved to the root directory since the 3.3 release.
What is defined in CONFIG. * should be adapted to all platforms. At the time of the build project, you will see the words "generating CONFIG. defaults for platform" "Android", and he will generate the various platform config.
Generated files:
- Android:myproject/platforms/android/res/xml/config.xml.
- Ios:myproject/platforms/ios/myproject/config.xml.
The generated config. config will of course add different content depending on the platform.
For example, under Android, the following is added to config:
XML code
- <preference name="loglevel" value="DEBUG" />
- <feature name="App">
- <param name="android-package" value="org.apache.cordova.App" />
- </feature>
The scheme of CONFIG. Widgets is based on the definition of the publisher.
Basic Construction:
XML code
- <widgets>
- <name></name>
- <preference />
- <feature>
- <param />
- </feature>
- <access />
- <content />
- </Widgets>
Preference:
Option settings. Some parameters of the application runtime are different depending on the platform settings.
Android Settings: http://cordova.apache.org/docs/en/3.4.0/guide_platforms_android_config.md.html
iOS settings: http://cordova.apache.org/docs/en/3.4.0/guide_platforms_ios_config.md.html
Access:
Domain throttling settings. In the app, if you read an HTML file in another domain, and if you use Cordova.js in that file, then he can access the local functionality of the phone. Comply with the Microsoft Access specification.
You can set multiple:
<access origin= "http://example.com"/>
<access origin= "http://foobar.example.com"/>
You can also use a wildcard character:
<access origin= "http://*.example.com"/>
Any domain can be accessed by default.
<access origin= "*"/>
Feature:
Which native features are used in the app, Cordova scans the feature property at run time to know which plugin are valid. The feature is added automatically when you execute Cordova plugin Add.
Like what:
Reference Cordova Plugin Add Org.apache.cordova.camera
Cordova Build
There will be more platforms/android/res/xml/config.xml in the following sections:
XML code
- <feature name="Camera">
- <param name="android-package" value="Org.apache.cordova.camera.CameraLauncher " />
- </feature>
content:
The application's entry file. The default is index.html.
Other:
Widget id attribute, Android is the app's package name, iOS is AppID.
The Version property of the widget is the app's build number (Android:versionname) (10 in version 3.5).
The name tag is the name of the app (save the file as UTF-8 supports Chinese).
In "Cordova create", the app name is not all in English letters, for example, "my App". Must contain English letters, because CORDOVACLI is used to generate mainactivity class names.
The latest version of the question has been fixed. CB-6511 Fixes build for Android when app name contains Unicode characters.
Set Version
Ios
Version (cfbundleshortversionstring)
Build (cfbundleversion)
Android
Android:versionname
Android:versioncode
Internationalization of application names
Ios
Cfbundledisplayname = "Sample App Name";
Android
Strings.xml app_name = "Sample app name";
Cordova 3.x Basic (5)--config file