Cordova 3.x Basic (5)--config file

Source: Internet
Author: User



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
  1. <preference name="loglevel" value="DEBUG" />
  2. <feature name="App">
  3. <param name="android-package" value="org.apache.cordova.App" />
  4. </feature>




The scheme of CONFIG. Widgets is based on the definition of the publisher.
Basic Construction:


XML code
  1. <widgets>
  2. <name></name>
  3. <preference />
  4. <feature>
  5. <param />
  6. </feature>
  7. <access />
  8. <content />
  9. </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
    1. <feature name="Camera">
    2. <param name="android-package" value="Org.apache.cordova.camera.CameraLauncher " />
    3. </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


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.