Apps built using PhoneGap Build can be set up either through the web interface, or by using a config.xml. The config.xml file, as specified in the W3C widget specification, allows developers to easily specify metadata about their applications. One thing to note: please ensure that your config.xml file is at the top level of your application (the same level as your index.html file).
Essential Properties
- <widget>: The widget element must be the root of your XML document – it lets us know that you are following the W3C specification. When using PhoneGap Build, ensure you have the following attributes set on your widget element:
- id: the unique identifier for your application. To support all supported platforms, this must be reverse-domain name style (e.g. com.yourcompany.yourapp)
- version: for best results, use a major/minor/patch style version, with three numbers, such as 0.0.1
- versionCode: (optional) when building for Android, you can set the versionCode by specifying it in your config.xml
- <name>: The name of the application
- <description>: A description for your application
<?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="1" version="1.0.0"> <name>App name</name> <description> App description </description> <author href="http://www.domain.com" email="email@domain.com"> author name </author> <access origin="*" /> <preference name="fullscreen" value="true" /> <preference name="orientation" value="portrait" /> <icon src="icons/ios/icon.png" gap:platform="ios" width="57" height="57" /> <icon src="icons/ios/icon-72.png" gap:platform="ios" width="72" height="72" /> <icon src="icons/ios/icon_at_2x.png" gap:platform="ios" width="114" height="114" /> <icon src="icons/android/ldpi.png" gap:platform="android" gap:density="ldpi" /> <icon src="icons/android/mdpi.png" gap:platform="android" gap:density="mdpi" /> <icon src="icons/android/hdpi.png" gap:platform="android" gap:density="hdpi" /> <icon src="icons/android/xhdpi.png" gap:platform="android" gap:density="xhdpi" /> <gap:splash src="splash/ios/Default.png" width="320" height="480" /> <gap:splash src="splash/ios/Default_at_2x.png" width="640" height="960" /> <gap:splash src="splash/ios/Default_iphone5.png" width="640" height="1136" /> <gap:splash src="splash/ios/Default-Portrait.png" width="768" height="1024" /> <gap:splash src="splash/android/ldpi.png" gap:platform="android" gap:density="ldpi" /> <gap:splash src="splash/android/mdpi.png" gap:platform="android" gap:density="mdpi" /> <gap:splash src="splash/android/hdpi.png" gap:platform="android" gap:density="hdpi" /> <gap:splash src="splash/android/xhdpi.png" gap:platform="android" gap:density="xhdpi" /> </widget> |
versionCode (= android:versionCode) is an integer value that represents the version of the application code, relative to other versions. Typically, you would release the first version of your application with versionCode set to 1.
version (= android:versionName) is a string value that represents the release version of the application code, as it should be shown to users. The value is a string so that you can describe the application version as a
One thought on “Cordova – PhoneGap: project settings in config.xml”