Monaca Docs
Search…
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

Attribute
Type
Default Value
Description
version
String
1.0.0
A version number which is visible to users
android-versionCode
String
(Automatically set) When version attribute is "1.22.33", it will be 102233 (=1 * 10000 + 22 * 100 + 33). If the project uses Crosswalk, it will be 2xxxxxx for ARM architecture and 7xxxxxx for x86 architecture.
An internal version code. It is used only to determine whether one version is more recent than others. Higher number indicates a more recent version. This version number is not shown to users.
Example
1
<widget id="com.example.helloworld" version="0.0.1" android-versionCode="7">
2
...
3
</widget>
Copied!

<content> element

Attribute
Type
Default Value
Description
src
String
indext.html
The <content> element defines the app's starting page in the top-level web assets directory. You can change the starting page by changing the value of the src attribute to your preferred URL.
Example
1
<widget id="com.example.helloworld" version="1.0.0">
2
...
3
<content src="https://monaca.io/" />
4
</widget>
Copied!

<access> element

Attribute
Type
Default Value
Description
origin
String
*
It is used to declare access to specific network domains. If set to *, you can access all domains from your app.
Example
1
...
2
<access origin="*" />
3
...
Copied!

<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.
Preference Name
Type
Default Value
Description
KeepRunning
Boolean
true
Determines whether Cordova will keep running in the background or not.
DisallowOverscroll
Boolean
false
Sets to true if you don’t want the interface to display any feedback when users scroll past the beginning or end of content.
Fullscreen
Boolean
false
Allows you to hide the status bar at the top of the screen.
SplashScreenDelay
Number
3000
Sets the default delay of how long the splashscreen appears in milliseconds. This should be the worst-case expected start time.
LogLevel
String
ERROR
Sets the minimum log level through which log messages from your application will be filtered. There are 5 valid values such as: ERROR, DEBUG, WARN, INFO and VERBOSE.
AndroidPersistentFileLocation*
String
Internal
Sets where to store Android persistent files. There are 2 valid values.
    Internal: will put persistent files under the user’s application internal storage directory.
    Compatibility: will put persistent files under storage root.
ScreenOrientation**
String
default
(Cordova 5.2 or Higher) Sets screen orientation for devices. There are 3 valid values.
    default: uses system default screen orientation.
    landscape: sets screen orientation to landscape mode.
    portrait sets screen orientation to portrait mode.
Example
1
...
2
<preference name="KeepRunning" value="false" />
3
<preference name="DisallowOverscroll" value="true"/>
4
<preference name="Fullscreen" value="true" />
5
<preference name="SplashScreenDelay" value="10000" />
6
<preference name="loglevel" value="DEBUG" />
7
<preference name="AndroidPersistentFileLocation" value="Internal" />
8
<preference name="orientation" value="default"/>
9
...
Copied!
*: 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:
    1
    <widget>
    2
    ....
    3
    <preference name="orientation" value="default"/>
    4
    ....
    5
    </widget>
    Copied!
    2.
    Platform Specific Settings:
    1
    <widget>
    2
    ...
    3
    <platform name="android">
    4
    <preference name="orientation" value="default"/>
    5
    </platform>
    6
    ...
    7
    </widget>
    Copied!

Specify the target API level

You can specify any target API level by using android-targetSdkVersion in the <preference> tag.
1
<platform name="android">
2
...
3
<preference name="android-targetSdkVersion" value="29" />
4
...
5
</platform>
Copied!
Last modified 2mo ago