Apache Cordova command line tool(CLI) provides a unified way to manage and build mobile applications across platforms. Unfortunately, it is not always possible to provide configuration options generic enough that span all supported platforms. For those cases, Cordova takes a platform specific approach.
Here is a small guide for 5 of these less known configuration options. All of these options are managed on the config.xml file on your project. As attributes of the root widget node.
Normally, the the package name for an Android application is generated from the id of the Cordova application. Presence of android-packageName on the config.xml causes the package name on AndroidManifest.xml and java package name for the activity class to be generated from its value.
The android-activityName attribute allows the main activity name to be specified. Activity name is one of those things that cannot change in Android. Therefore this feature becomes useful when renewing an older implementation with a Cordova based one or upgrading between Cordova versions that have different default activity name values.
Sets the versionCode value on the application’s manifest file. If android-versionCode is not specified versionCode is generated to have the default value of 1. If you are wondering why the default value is 1 instead of the value of the version attribute, this is because versionCode is restricted to be an integer.
ios-CFBundleIdentifier determines the value of CFBundleIdentifier key in the Info.plist file of your application. This key is the unique identifier for your application on the system. If ios-CFBundleIdentifier is not specified the value of the id field will be used when generating Info.plist.
This is the iOS cousin of the android-versionCode explained earlier. They pretty much serve similar purpose on their respective platforms. You should be aware of the quirks when defining the value. If ios-CFBundleVersion is not specified the value of the version attribute is used for generating the iOS application.
Here is a complete example that specifies all the values:
<widget id="application.id" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" android-packageName="the.android.packname" android-activityName="MyCoolActivity" android-versionCode="4" ios-CFBundleIdentifier="my.legacy.ios.id" ios-CFBundleVersion="0.0.3"> </widget>