Preferences
For a complete list of all of the preferences supported, refer to the Apache Cordova config.xml preferences documentation.
PhoneGap utilizes the <preference>
tag to customize your application configuration. All <preference>
tags in your config.xml are copied to the platform-specific configuration files, which means that any preferences supported by the Cordova framework, or by any plugins you are using, will work on PhoneGap Build.
Note: make sure you select your Cordova version when looking at the Cordova docs page.
In addition, PhoneGap Build supports some of its own custom preferences, used for things like selecting the PhoneGap version, platform sdk version targeting, and others. These custom preferences are listed below.
If you want to see more detail about what exactly these custom preferences are doing, most of them are translated using the open-source confetti library. Check out the templates directory if you want to dig in.
Multi-Platform
iOS Only
Android Only
- android-versionCode
- android-build-tool
- android-minSdkVersion
- android-maxSdkVersion
- android-targetSdkVersion
- android-installLocation
- android-windowSoftInputMode
Note: The AndroidLaunchMode preference is not currently supported on Phonegap Build. You can work around this by using the config-file element to set the value in your config.xml directly:
<config-file platform="android" parent="/manifest/application" mode="merge">
<activity android:launchMode="singleTop" />
</config-file>
Windows Only (cli-6.1.1 and above)
Examples
Multi-Platform
default, landscape, or portrait
. Please note that default
means both landscape and portrait are enabled. If you want to use each platform's default settings (usually portrait only), remove this tag from your config.xml file.true or false
. This hides the status bar at the top, and is false by default. Note: may not be supported by newer versions of iOS, but users can use
the config-file element on phonegap build, and set UIViewControllerBasedStatusBarAppearance to false and UIStatusBarHidden to true.id
or title
. If a title is specified it will use the most recently uploaded key with that title. A platform
must be specified either placing this preference inside a platform tag or adding a platform attribute.iOS Only
handset, tablet, or universal
. Note that this currently only applies to iOS builds; by default all builds are universal.true or false
, default is false.```xml
<meta name="format-detection" content="telephone=no">
<meta name="format-detection" content="email=no">
```
And use detect-data-types if meta tags don't work for you.
IPHONEOS_DEPLOYMENT_TARGET
in the build, which tranlsates to the MinimumOSVersion
in the ipa Property List.SWIFT_VERSION
for the build. Valid values are 2.3 or 3.0. Defaults to 3.0Android Only
usesSdk
attributes in the AndroidManifest.xml
file - more details are in the Android documentation:(http://developer.android.com/guide/topics/manifest/uses-sdk-element.html). Defaults to 14 (Android >= 4.0).usesSdk
attributes in the AndroidManifest.xml
file - more details are in the Android documentation. Unset by default.usesSdk
attributes in the AndroidManifest.xml
file -- an integer designating the API Level that the application targets. If not set, the default value equals that given to minSdkVersion. More details are in the Android documentation. Unset by default.internalOnly
(as the Android SDK). auto
or preferExternal
allow the app to be installed on an SD card - this can lead to unexpected behavior. More details available in the Android documentation.Windows Only
Example Config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.phonegap.example"
versionCode = "10"
version = "1.0.0" >
<name>PhoneGap Example</name>
<description>
An example for phonegap build docs.
</description>
<author href="https://build.phonegap.com" email="support@phonegap.com">
wildabeast
</author>
<!-- all platforms -->
<preference name="phonegap-version" value="cli-6.0.0" />
<preference name="orientation" value="landscape" />
<preference name="fullscreen" value="true" />
<!-- iOS only -->
<preference name="target-device" value="universal" />
<preference name="prerendered-icon" value="true" />
<preference name="detect-data-types" value="true" />
<preference name="exit-on-suspend" value="true" />
<preference name="deployment-target" value="7.0" />
<!-- Android only -->
<preference name="android-build-tool" value="ant|gradle" />
<preference name="android-minSdkVersion" value="10" />
<preference name="android-maxSdkVersion" value="15" />
<preference name="android-targetSdkVersion" value="12" />
<preference name="android-installLocation" value="auto" />
<preference name="android-windowSoftInputMode" value="stateVisible|adjustResize" />
</widget>
Platform Selection
By default, preferences are for all platforms. To specify a preference to be for a single platform you can place any preference inside a platform tag.
<platform name="ios" >
<preference name="orientation" value="landscape" />
</platform>
<platform name="android" >
<preference name="orientation" value="portrait" />
</platform>
This fragment will make the iOS app be available in landscape orientation while the android app will be in portrait mode.
Edit this page on GitHub