Config.xml
config.xml
is a global configuration file that controls many aspects
of a cordova application's behavior. This
platform-agnostic XML file is arranged based on the W3C's Packaged
Web Apps (Widgets) specification, and
extended to specify core Cordova API features, plugins, and
platform-specific settings.
For projects created with the Cordova CLI (described in The Command-Line Interface), this file can be found in the top-level directory:
app/config.xml
Note that before version 3.3.1-0.2.0, the file existed at app/www/config.xml
,
and that having it here is still supported.
When using the CLI to build a project, versions of this file are
passively copied into various platforms/
subdirectories.
For example:
app/platforms/ios/AppName/config.xml
app/platforms/android/res/xml/config.xml
In addition to the various configuration options detailed below, you can also configure an application's core set of images for each target platform. See Customize icons topic for more information.
widget
Root element of the config.xml document.
Attributes(type) Only for platform: |
Description |
---|---|
id(string) | Required Specifies the app's identifier. The id should be in a reverse-DNS format however, only alphanumeric and dot characters are allowed. e.g: com.example.myapp |
version(string) | Required Full version number expressed in major/minor/patch notation. |
android-versionCode(string) |
Alternative version for Android. Sets the version code for the application. See the Android guide for information on how this attribute may be modified. |
ios-CFBundleVersion(string) |
Alternative version for iOS. For further details, see iOS versioning. |
osx-CFBundleVersion(string) ==OS X== |
Alternative version for OS X. For further details, see OS X versioning. |
windows-packageVersion(string) |
Alternative version for Windows. For futher details, see Windows versioning |
android-packageName(string) |
Alternative package name for Android, overrides id . |
ios-CFBundleIdentifier(string) |
Alternative bundle id for iOS. Overrides id . |
packageName(string) |
Default: Cordova.Example Package name for Windows. |
defaultlocale |
Specified the default language of the app, as an IANA language code. |
android-activityName(string) |
Set the activity name for your app in AndroidManifest.xml. Note that this is only set once after the Android platform is first added. |
xmlns(string) | Required Namespace for the config.xml document. |
xmlns:cdv(string) | Required Namespace prefix. |
Examples:
<!-- Android -->
<widget id="io.cordova.hellocordova" version="0.0.1" android-versionCode="13" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
</widget>
<!-- iOS -->
<widget id="io.cordova.hellocordova" version="0.0.1" ios-CFBundleVersion="0.1.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
</widget>
<!-- Windows -->
<widget id="io.cordova.hellocordova" version="0.0.1" windows-packageVersion="0.1.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
</widget>
<!-- OS X -->
<widget id="io.cordova.hellocordova" version="0.0.1" osx-CFBundleVersion="0.1.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
</widget>
name
Specifies the app's formal name, as it appears on the device's home screen and within app-store interfaces.
Examples:
<widget ...>
<name>HelloCordova</name>
</widget>
short name
Specifies an optional display name for the app. Sometimes the app name should be displayed differently on device's home screen than on informational and app-store interfaces due to limited space.
Examples:
<widget ...>
<name short="HiCdv">HelloCordova</name>
</widget>
description
Specifies metadata that may appear within app-store listings.
Examples:
<widget ...>
<description>A sample Apache Cordova application</description>
</widget>
author
Specifies contact information that may appear within app-store listings.
Attributes(type) Only for platform: |
Description |
---|---|
email(string) | Required Email of the author. |
href(string) | Required Website of the author. |
Examples:
<widget ...>
<author email="dev@cordova.apache.org" href="http://cordova.io"></author>
</widget>
content
Defines the app's starting page in the top-level web assets directory. The default value is index.html, which customarily appears in a project's top-level www
directory.
Attributes(type) Only for platform: |
Description |
---|---|
src(string) | Required Defines the app's starting page in the top-level web assets directory. The default value is index.html, which customarily appears in a project's top-level www directory. |
Examples:
<widget ...>
<content src="startPage.html"></content>
</widget>
access
Defines the set of external domains the app is allowed to communicate with. The default value shown above allows it to access any server. See the Domain Whitelist Guide for details.
Attributes(type) Only for platform: |
Description |
---|---|
origin(string) | Required Defines the set of external domains the app is allowed to communicate with. The default value shown above allows it to access any server. See the Domain Whitelist Guide for details. |
Examples:
<widget ...>
<access origin="*"></access>
</widget>
<widget ...>
<access origin="http://google.com"></access>
</widget>
allow-navigation
Controls which URLs the WebView itself can be navigated to. Applies to top-level navigations only.
Attributes(type) Only for platform: |
Description |
---|---|
href(string) | Required Defines the set of external domains the WebView is allowed to navigate to. See the Allow List Guide for details. |
Examples:
<!-- Allow links to example.com -->
<allow-navigation href="http://example.com/*" />
<!-- Wildcards are allowed for the protocol, as a prefix to the host, or as a suffix to the path -->
<allow-navigation href="*://*.example.com/*" />
allow-intent
Controls which URLs the app is allowed to ask the system to open. By default, no external URLs are allowed.
Attributes(type) Only for platform: |
Description |
---|---|
href(string) | Required Defines which URLs the app is allowed to ask the system to open. See the Allow List Guide for details. |
Examples:
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
edit-config
See <edit-config> docs for plugin.xml.
config-file
See <config-file> docs for plugin.xml.
engine
Specifies details about what platform to restore during a prepare.
Attributes(type) Only for platform: |
Description |
---|---|
name(string) | Required Name of the platform to be restored |
spec(string) | Required Details about the platform to be restored. This could be a major.minor.patch version number, a directory containing the platform or a url pointing to a git repository. This information will be used to retrieve the platform code to restore from NPM, a local directory or a git repository. See Platform Spec for further details. |
Examples:
<engine name="android" spec="https://github.com/apache/cordova-android.git#5.1.1" />
<engine name="ios" spec="^4.0.0" />
plugin
Specifies details about what plugin to restore during a prepare. This element
is automatically added to a project's config.xml
when a plugin is added using
the --save
flag. See the CLI reference for more information on
adding plugins.
Attributes(type) Only for platform: |
Description |
---|---|
name(string) | Required Name of the plugin to be restored |
spec(string) | Required Details about the plugin to be restored. This could be a major.minor.patch version number, a directory containing the plugin or a url pointing to a git repository. This information will be used to retrieve the plugin code to restore from NPM, a local directory or a git repository. See Plugin Spec for further details. |
Examples:
<plugin name="cordova-plugin-device" spec="^1.1.0" />
<plugin name="cordova-plugin-device" spec="https://github.com/apache/cordova-plugin-device.git#1.0.0" />
variable
Persists the value of a CLI variable to be used when restoring a plugin during a
prepare. This element is added to config.xml
when a plugin that uses CLI variables
is added using the --save
flag. See the CLI reference for more
information on adding plugins.
Note that this value is only used when the plugin is restored to the project during a
prepare, changing it will not change the value used by the plugin in the current
project. In order for changes to this value to take effect, remove the plugin from the
project and restore it by running cordova prepare
. See the
preference element of plugin.xml
for more details on CLI variables.
Attributes(type) Only for platform: |
Description |
---|---|
name(string) | Required Name of the CLI variable. Can only contain capital letters, digits, and underscores. |
value(string) | Required Value of the CLI variable to be used when restoring the parent plugin during a prepare. |
Examples:
<plugin name="cordova-plugin-device" spec="^1.1.0">
<variable name="MY_VARIABLE" value="my_variable_value" />
</plugin>
preference
Sets various options as pairs of name/value attributes. Each preference's name is case-insensitive. Many preferences are unique to specific platforms, and will be indicated as such.
Attributes(type) Only for platform: |
Description |
---|---|
AllowInlineMediaPlayback(boolean) |
Default: false Set to true to allow HTML5 media playback to appear inline within the screen layout, using browser-supplied controls rather than native controls. For this to work, add the playsinline attribute to any <video> elements. NOTE: Prior to iOS 10, <video> elements need to use the webkit-playsinline attribute name instead. |
AllowNewWindows(boolean) |
Default: false Set to true to allow JavaScript window.open and HTML target="_blank" links to open a new view overlaying the web view. |
AndroidLaunchMode(string) |
Default: singleTop Allowed values: standard, singleTop, singleTask, singleInstance Sets the Activity android:launchMode attribute. This changes what happens when the app is launched from app icon or intent and is already running. |
AndroidInsecureFileModeEnabled(boolean) |
Default: false If set to true loading file:/// URLs is allowed. Note: Enabling this setting allows malicious scripts loaded in a file:/// context to launch cross-site scripting attacks, either accessing arbitrary local files including WebView cookies, app private data or even credentials used on arbitrary web sites. |
android-maxSdkVersion(integer) |
Default: Not Specified Sets the maxSdkVersion attribute of the <uses-sdk> tag in the project's AndroidManifest.xml (see here). |
android-minSdkVersion(integer) |
Default: Dependent on cordova-android Version Sets the minSdkVersion attribute of the <uses-sdk> tag in the project's AndroidManifest.xml (see here). |
android-targetSdkVersion(integer) |
Default: Dependent on cordova-android Version Sets the targetSdkVersion attribute of the <uses-sdk> tag in the project's AndroidManifest.xml (see here). |
AppendUserAgent(string) |
If set, the value will append to the end of old UserAgent of webview. When using with OverrideUserAgent, this value will be ignored. |
BackgroundColor(string) |
Sets the app's background color. Supports a four-byte hex value, with the first byte representing the alpha channel, and standard RGB values for the following three bytes. For Windows, the alpha channel is ignored. Note: transparent value will set the application tile background to the accent color on Windows. |
BackupWebStorage(string) |
Default: cloud Allowed values: none, local, cloud. Set to cloud to allow web storage data to backup via iCloud. Set to local to allow only local backups via iTunes sync. Set to none prevent web storage backups. |
CordovaWebViewEngine(string) |
Default: CDVWebViewEngine This sets the WebView engine plugin to be used to render the host app. The plugin must conform to the CDVWebViewEngineProtocol protocol. The 'value' here should match the 'feature' name of the WebView engine plugin that is installed. This preference usually would be set by the WebView engine plugin that is installed, automatically. |
DefaultVolumeStream(string) |
Default: default Added in cordova-android 3.7.0, This preference sets which volume the hardware volume buttons link to. By default this is "call" for phones and "media" for tablets. Set this to "media" to have your app's volume buttons always change the media volume. Note that when using Cordova's media plugin, the volume buttons will dynamically change to controlling the media volume when any Media objects are active. |
DisallowOverscroll(boolean) |
Default: false Set to true if you don't want the interface to display any feedback when users scroll past the beginning or end of content. On iOS, overscroll gestures cause content to bounce back to its original position. on Android, they produce a more subtle glowing effect along the top or bottom edge of the content. |
EnableViewportScale(boolean) |
Default: false Set to true to allow a viewport meta tag to either disable or restrict the range of user scaling, which is enabled by default. Place a viewport such as the following in the HTML to disable scaling and fit content flexibly within the rendering WebView: <meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no' /> |
EnableWebGL(boolean) ==OS X== |
Default: false (OS X 4.0.0+) Set to true to enable WebGL on the web view. |
ErrorUrl(URL) |
Default: null If set, will display the referenced page upon an error in the application instead of a dialog with the title "Application Error". |
ErrorUrl(string) |
If set, will display the referenced local page upon an error in the application. |
ForegroundText(string) |
Default: "light" Works for Windows 8.1 projects only. Allowed values: "light", "dark". Set to "dark" if you use the BackgroundColor="white" or another light color to avoid Windows Store submissions errors. |
FullScreen(boolean) |
Default: false Allows you to hide the status bar at the top of the screen. Note: Recommended platform-agnostic way to achieve this is to use the StatusBar plugin. |
GapBetweenPages(float) |
Default: 0 The size of the gap, in points, between pages. |
HideMousePointer(integer) ==OS X== |
Default: -1 (OS X 4.0.0+) Sets the timeout for hiding the mouse pointer. Set to 0 for immediate, set to -1 for never. |
GradlePluginGoogleServicesEnabled (boolean) |
Default: false Set to true to enable the Google Services Gradle plugin. |
GradlePluginGoogleServicesVersion (semver) |
Default: 4.2.0 Set version of Google Services Gradle plugin to be used. |
GradlePluginKotlinEnabled (boolean) |
Default: false Set to true to allow Kotlin files to be built. |
GradlePluginKotlinCodeStyle (string) |
Default: official Allowed values: official, obsolete Sets how the Kotlin code is formatting for readability. |
GradlePluginKotlinVersion (semver) |
Default: 1.3.50 Set the version of the Kotlin Gradle plugin to be used. |
InAppBrowserStorageEnabled (boolean) |
Default: true Controls whether pages opened within an InAppBrowser can access the same localStorage and WebSQL storage as pages opened with the default browser. |
KeepRunning(boolean) |
Default: true Determines whether the application stays running in the background even after a pause event fires. Setting this to false does not kill the app after a pause event, but simply halts execution of code within the cordova webview while the app is in the background. |
KeyboardDisplayRequiresUserAction(boolean) |
Default: true Set to false to allow the keyboard to appear when calling focus() on form inputs. |
LoadUrlTimeoutValue(number in milliseconds) |
Default: 20000, 20 seconds When loading a page, the amount of time to wait before throwing a timeout error. |
LoadingDialog(string) |
Default: null If set, displays a dialog with the specified title and message, and a spinner, when loading the first page of an application. The title and message are separated by a comma in this value string, and that comma is removed before the dialog is displayed. |
LogLevel(string) |
Default: DEBUG Allowed values: ERROR, WARN, INFO, DEBUG, VERBOSE Sets the minimum log level through which log messages from your application will be filtered. |
MediaPlaybackAllowsAirPlay(boolean) |
Default: true Set to false to prevent Air Play from being used in this view. Available in default UIWebView and WKWebView. |
MediaPlaybackRequiresUserAction(boolean) |
Default: false Set to true to prevent HTML5 videos or audios from playing automatically with the autoplay attribute or via JavaScript. |
Min/Max Version(Regex) |
Allowed values: /(Microsoft.+? | Windows.+?)-(MinVersion | MaxVersionTested)/i Identifies the ecosystems and their min/max versions the app is compatible with. There are three parts to each value: the SDK, the version restriction, and the version value. These preferences are detected by beginning with Windows or Microsoft and ending in -MinVersion or -MaxVersionTested : <ul><li>The SDK defines what specialized platform you want to target. The default is Windows.Universal . Valid values for these are defined in the AppxManifest schema, in the Package/Dependencies/TargetPlatform elements.</li><li>The version restriction defines application compatibility rules. For example, if the -MinVersion is set to 10.1.0.0, then OS versions which don't support at least 10.1.0.0 of the corresponding SDK won't be able to load it. Similarly you can also use -MaxVersionTested which specifies the highest-tested version of the SDK. If a new version of the corresponding SDK is released, it will run in compatibility mode for the specified version.</li><li>The version value is a 4-integer tuple in the form of major.minor.build.qfe.</li></ul> If no preferences of these types are specified in your config.xml file, then Windows.Universal version 10.0.0.0 will be chosen by default. Note: These preferences are only set in the appxmanifest files of the desired target-platform and not in the jsproj files. |
Orientation(string) | Default: default Allowed values: default, landscape, portrait Allows you to lock orientation and prevent the interface from rotating in response to changes in orientation. NOTE: The default value means Cordova will strip the orientation preference entry from the platform's manifest/configuration file allowing the platform to fallback to its default behavior. For iOS, to specify both portrait & landscape mode you would use the platform specific value 'all'. |
OSXLocalStoragePath(string) ==OS X== |
Default: ~/Library/Application Support/{bundle.id} (OS X 4.0.0+) Sets the directory for the local storage path. |
OverrideUserAgent(string) |
If set, the value will replace the old UserAgent of webview. It is helpful to identify the request from app/browser when requesting remote pages. Use with caution, this may cause compatibility issues with web servers. For most cases, use AppendUserAgent instead. |
PageLength(float) |
Default: 0 The size of each page, in points, in the direction that the pages flow. When PaginationMode is right to left or left to right, this property represents the width of each page. When PaginationMode is topToBottom or bottomToTop, this property represents the height of each page. The default value is 0, which means the layout uses the size of the viewport to determine the dimensions of the page. |
PaginationBreakingMode(string) |
Default: page Allowed values: page, column Valid values are page and column.The manner in which column- or page-breaking occurs. This property determines whether certain CSS properties regarding column- and page-breaking are honored or ignored. When this property is set to column, the content respects the CSS properties related to column-breaking in place of page-breaking. |
PaginationMode(string) |
Default: unpaginated Allowed values: unpaginated, leftToRight, topToBottom, bottomToTop, rightToLeft This property determines whether content in the web view is broken up into pages that fill the view one screen at a time,or shown as one long scrolling view. If set to a paginated form, this property toggles a paginated layout on the content, causing the web view to use the values of PageLength and GapBetweenPages to relayout its content. |
PreferredContentMode(string) |
Default: auto Sets the content mode (user agent) for the WebView and InAppBrowsers WebView on iPads. Valid values are: mobile and desktop . |
InAppBrowserStatusBarStyle(string) |
Default: default Set text color style of the StatusBar for InAppBrowser for iOS. Valid values are: lightcontent and default . |
SetFullscreen(boolean) |
Default: false Same as the Fullscreen parameter in the global configuration of this xml file. This Android-specific element is deprecated in favor of the global Fullscreen element, and will be removed in a future version. |
ShowTitle(boolean) |
Default: false Show the title at the top of the screen. |
SplashScreenBackgroundColor |
Default: #464646 Sets the splashscreen background color. Supports a CSS color name or a four-byte hex value, with the first byte representing the alpha channel, and standard RGB values for the following three bytes. The alpha channel is ignored although transparent value will cause black/white background color in case of Dark/Light theme accordingly. |
Suppresses3DTouchGesture(boolean) |
Default: false Set to true to avoid 3D Touch capable iOS devices rendering a magnifying glass widget when the user applies force while longpressing the webview. Test your app thoroughly since this disables onclick handlers, but plays nice with ontouchend. If this setting is true, SuppressesLongPressGesture will effectively be true as well. |
SuppressesIncrementalRendering(boolean) |
Default: false Set to true to wait until all content has been received before it renders to the screen. |
SuppressesLongPressGesture(boolean) |
Default: false Set to true to avoid iOS9+ rendering a magnifying glass widget when the user longpresses the webview. Test your app thoroughly since this may interfere with text selection capabilities. |
SwiftVersion(string) |
Default: (empty) Set to specify the Swift Version. |
TopActivityIndicator(string) |
Default: gray Allowed values: whiteLarge, white, gray. Controls the appearance of the small spinning icon in the status bar that indicates significant processor activity. |
uap-target-min-version(string) |
This property sets the MinTargetVersion for the Windows UAP. If not specified, this is set to the initial release version 10.0.10240.0 Note: This preference is set in the jsproj file and not in the appxmanifest file. So users with OS version lower than this value would not be able to run the app. |
UIWebViewDecelerationSpeed(string) |
Default: normal Allowed values: normal, fast This property controls the deceleration speed of momentum scrolling. normal is the default speed for most native apps, and fast is the default for Mobile Safari. |
WindowSize(string) ==OS X== |
Default: auto (OS X 4.0.0+) Sets the size of the application window. Accepts the format WxH for a specific width and height or the special values auto and fullscreen . The latter will open a borderless window spanning the entire desktop area. Please note, that this is different from the normal OS X fullscreen mode, which would never span multiple displays. Note: The global cordova fullscreen preference has no effect in OS X. |
WindowsDefaultUriPrefix(string) |
Allowed values: ms-appx:// , ms-appx-web:// Identifies whether you want your app to target the local context or remote context as its startup URI. When building for Windows 10, the default is the remote context ( ms-appx-web:// ). In order to have a local-mode application that is not impacted by Remote Mode capability restrictions, you must set this preference to ms-appx:// and not declare any <access> elements with remote URIs. The local mode is the default for Windows 8.1 |
WindowsStoreDisplayName(string) |
A friendly name for the publisher that can be displayed to users. |
WindowsStoreIdentityName(string) |
Identity name used for Windows store. The identity defines a globally unique identifier for a package. A package identity is represented as a tuple of attributes of the package. See the identity page on the package manifest schema reference for further details. |
WindowsStorePublisherName(string) |
Publisher Display Name. |
WindowsToastCapable(boolean) |
Default: false A value of true indicates that the app is allowed to provide 'toast notifications'. |
deployment-target(string) |
This sets the IPHONEOS_DEPLOYMENT_TARGET in the build, which ultimately translates to the MinimumOSVersion in the ipa. For more details please refer to Apple's documentation on Deployment Target Settings |
target-device(string) |
Default: universal Allowed values: handset, tablet, universal This property maps directly to TARGETED_DEVICE_FAMILY in the xcode project. Note that if you target universal (which is the default) you will need to supply screen shots for both iPhone and iPad or your app may be rejected. |
windows-phone-target-version(string) |
Sets the version of Windows Phone for which the package (resulting from cordova build ) will target. If none is specified, it will be set to the same version as windows-target-version (if found). |
windows-target-version(string) |
Sets the version of Windows for which the package (resulting from cordova build ) will target. If none is specified, it will be set to '8.1'. |
Examples:
<preference name="DisallowOverscroll" value="true"/>
<preference name="Fullscreen" value="true" />
<preference name="BackgroundColor" value="0xff0000ff"/>
<preference name="HideKeyboardFormAccessoryBar" value="true"/>
<preference name="Orientation" value="landscape" />
<!-- iOS only preferences -->
<preference name="EnableViewportScale" value="true"/>
<preference name="MediaPlaybackAllowsAirPlay" value="false"/>
<preference name="MediaPlaybackRequiresUserAction" value="true"/>
<preference name="AllowInlineMediaPlayback" value="true"/>
<preference name="BackupWebStorage" value="local"/>
<preference name="TopActivityIndicator" value="white"/>
<preference name="SuppressesIncrementalRendering" value="true"/>
<preference name="GapBetweenPages" value="0"/>
<preference name="PageLength" value="0"/>
<preference name="PaginationBreakingMode" value="page"/>
<preference name="PaginationMode" value="unpaginated"/>
<preference name="UIWebViewDecelerationSpeed" value="fast" />
<preference name="ErrorUrl" value="myErrorPage.html"/>
<preference name="OverrideUserAgent" value="Mozilla/5.0 My Browser" />
<preference name="AppendUserAgent" value="My Browser" />
<preference name="target-device" value="universal" />
<preference name="deployment-target" value="7.0" />
<preference name="CordovaWebViewEngine" value="CDVWebViewEngine" />
<preference name="CordovaDefaultWebViewEngine" value="CDVWebViewEngine" />
<preference name="SuppressesLongPressGesture" value="true" />
<preference name="Suppresses3DTouchGesture" value="true" />
<!-- Android only preferences -->
<preference name="KeepRunning" value="false"/>
<preference name="LoadUrlTimeoutValue" value="10000"/>
<preference name="InAppBrowserStorageEnabled" value="true"/>
<preference name="LoadingDialog" value="My Title,My Message"/>
<preference name="ErrorUrl" value="myErrorPage.html"/>
<preference name="ShowTitle" value="true"/>
<preference name="LogLevel" value="VERBOSE"/>
<preference name="AndroidLaunchMode" value="singleTop"/>
<preference name="AndroidInsecureFileModeEnabled" value="true" />
<preference name="DefaultVolumeStream" value="call" />
<preference name="OverrideUserAgent" value="Mozilla/5.0 My Browser" />
<preference name="AppendUserAgent" value="My Browser" />
<preference name="GradlePluginGoogleServicesEnabled" value="true" />
<preference name="GradlePluginGoogleServicesVersion" value="4.2.0" />
<preference name="GradlePluginKotlinEnabled" value="true" />
<preference name="GradlePluginKotlinCodeStyle" value="official" />
<preference name="GradlePluginKotlinVersion" value="1.3.50" />
<!-- Windows only preferences -->
<preference name="windows-target-version" value="8.1" />
<preference name="windows-phone-target-version" value="8.1" />
<preference name="WindowsDefaultUriPrefix" value="ms-appx://" />
<preference name="Windows.Mobile-MaxVersionTested" value="10.0.10031.0" />
<preference name="Windows.Universal-MinVersion" value="10.0.0.0" />
<preference name="WindowsStoreIdentityName" value="Cordova.Example.ApplicationDataSample" />
<preference name="WindowsStorePublisherName" value="CN=Contoso Corp, O=Contoso Corp, L=Redmond, S=Washington, C=US" />
<preference name="WindowsToastCapable" value="true" />
<preference name="uap-target-min-version" value="10.0.10586.0" />
<!-- OS X only preferences -->
<preference name="HideMousePointer" value="5"/>
<preference name="OSXLocalStoragePath" value="~/.myapp/database"/>
<preference name="WindowSize" value="800x400"/>
<preference name="EnableWebGL" value="true"/>
feature
If you use the CLI to build applications, you use the plugin command to enable device APIs. This does not modify the top-level config.xml file, so the
Attributes(type) Only for platform: |
Description |
---|---|
name(string) | Required The name of the plugin to enable. |
param
Used to specify certain plugin parameters such as: what package to retrieve the plugin code from, and whether the plugin code is to be initialized during the Webview's initialization.
Attributes(type) Only for platform: |
Description |
---|---|
name(string) ==OS X== |
Required Allowed values: android-package, ios-package, osx-package, onload. 'ios-package', 'osx-package' and 'android-package' are used to specify the name of the package (as specified by the 'value' attribute) to be used to initialize the plugin code, while 'onload' is used to specify whether the corresponding plugin (as specified in the 'value' attribute) is to be instantiated when the controller is initialized. |
value(string or boolean) ==OS X== |
Required Specifies the name of the package to be used to initialize the plugin code (when the 'name' attribute is android-package, ios-package or osx-package), specifies the name of the plugin to be loaded during controller initialization (when 'name' attribute is set to 'onload'). |
Examples:
<!-- Here is how to specify the Device API for Android projects -->
<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device" />
</feature>
<!-- Here's how the element appears for iOS projects -->
<feature name="Device">
<param name="ios-package" value="CDVDevice" />
<param name="onload" value="true" />
</feature>
<!-- Here's how the element appears for OS X projects -->
<feature name="Device">
<param name="osx-package" value="CDVDevice" />
<param name="onload" value="true" />
</feature>
platform
When using the CLI to build applications, it is sometimes necessary to specify preferences or other elements specific to a particular platform. Use the
Attributes(type) Only for platform: |
Description |
---|---|
name(string) | Required The platform whose preferences are being defined. |
Examples:
<platform name="android">
<preference name="Fullscreen" value="true" />
</platform>
hook
Represents your custom script which will be called by Cordova when certain action occurs (for example, after plugin is added or platform prepare logic is invoked). This is useful when you need to extend default Cordova functionality. See Hooks Guide for more information.
Attributes(type) Only for platform: |
Description |
---|---|
type(string) | Required Specifies the action during which the custom script is to be called. |
src(string) | Required Specifies the location of the script to be called when a specific action occurs. |
Examples:
<hook type="after_plugin_install" src="scripts/afterPluginInstall.js" />
resource-file
This tag installs resource files into your platform, and is similar to the same tag in plugin.xml. This tag is currently only supported on cordova-ios@4.4.0
or greater and cordova-android@6.2.1
or greater.
Attributes(type) Only for platform: |
Description |
---|---|
src(string) |
Required Location of the file relative to config.xml . |
target(string) | Path to where the file will be copied in your directory. |
Examples:
For Android:
<resource-file src="FooPluginStrings.xml" target="res/values/FooPluginStrings.xml" />
Sample config.xml
Below is a sample config.xml file:
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>