Hello
Today we will discuss in details about the config.xml file in PhoneGap
The config.xml file allows developers to specify metadata about their application. To load the config.xml file correctly it should be at the top level of the application i.e. same as index.html file.
Essential Properties
widget: It helps to identify that you are following the W3C specification. It must be the root of the XML document.The widget element has following attributes:
id: The unique identifier of the application. To support all platforms it must be reverse-domain name style
version: Full Version number expressed in major/minor/patch notation
version code: To specify alternative versions. (versin code for Android & CFBudleVersion for iOS.
name: The name of the application as it appears on the device's home screen and within app-store.
description: A description for your application.
Platform Build Selection
If we only want to build the Application for certain platforms we can specify the platforms with the gap:platform tag.
gap:platform: You can have zero or more of these elements in config.xml. By default all platforms will be built.
name: platform to build (android,iOs,blackberry etc)
Preferences
You can have zero or more of preference elements in config.xml. The attributes for the element are name and value. gap:config-file has following attributes:
platform: iOS/android
parent
overwrite: true(overwrite the default array)/ false(merge with default array)
Icons and Splash Screens
To define the platform specific icons instead of default icons icon element is used.
You can have zero or more of these elements in config.xml. By default PhoneGap logo is used.
It has following attributes:
src: location of image file
width: in pixels
height: in pixels
The default icon must be named icon.png and must reside in the root of the application folder
splash screens : To define the platform specific splash screens instead of default gap:splash is used.This element can have src, gap:platform,width and height attribute
Custom URL Schemes
gap:url-scheme Your app can have many url-scheme elements present.
Features
The feature element can be used to specify which features your application is using.
Sample Config.xml file
<widget id="com.app.garlib" version="0.0.1"><name>diamdirect</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="*"/></widget>
0 Comment(s)