config.xml

The config.xml file is a settings file controlling various settings of Cordova.

Below are available elements and preferences you may need to configure:

<widget> element

Example

<widget id="com.example.helloworld" version="0.0.1" android-versionCode="7">
  ...
</widget>

<content> element

Example

<widget id="com.example.helloworld" version="1.0.0">
  ...
  <content src="https://monaca.io/" />
</widget>

<access> element

Example

...
<access origin="*" />
...

<preference> element

The <preference> tag sets various options as pairs of name/value attributes. Each preference's name is case-insensitive. Many preferences are unique to specific platforms, as listed at the top of this page. The following sections detail preferences that apply to more than one platform.

Example

...
<preference name="KeepRunning" value="false" />
<preference name="DisallowOverscroll" value="true"/>
<preference name="Fullscreen" value="true" />
<preference name="SplashScreenDelay" value="10000" />
<preference name="loglevel" value="DEBUG" />
<preference name="AndroidPersistentFileLocation" value="Internal" />
<preference name="orientation" value="default"/>
...

*: If your application has previously been shipped to users, using an older (pre- 3.0.0) version of this plugin, and has stored files in the persistent filesystem, then you should set the preference to Compatibility if your config.xml does not specify a location for the persistent filesystem. Switching the value of AndroidPersistentFileLocation to Internal would mean that existing users who upgrade their application may be unable to access their previously-stored files, depending on their device.

**: There are two use ways to configure ScreenOrientation preference:

  1. Global Settings:

    <widget>
     ....
     <preference name="orientation" value="default"/>
     ....
    </widget>
  2. Platform Specific Settings:

    <widget>
     ...
     <platform name="android">
     <preference name="orientation" value="default"/>
     </platform>
     ...
    </widget>

Specify the target API level

You can specify any target API level by using android-targetSdkVersion in the <preference> tag.

<platform name="android">
    ...
    <preference name="android-targetSdkVersion" value="29" />
    ...
</platform>

Last updated