This question already has an answer here:
Due to legacy factors, the package names of my Android and iOS apps are different. Currently Cordova seems to be injecting the widget id attribute from config.xml into both when building. Is there no way to customize this? If I edit the AndroidManifest.xml directly, I expect it will get overwritten pretty soon.
Thanks.
A way to automate this is by adding in an after prepare hook. I started out with the example of how to Replace Text Depending on Environment from here: http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/.
I've got a project.json in my project that specifies what id I want to use for each platform:
Then in the /hooks directory I have an /after_prepare directory with a replace_text.js as follows:
Please make sure to replace the values indicated with < > brackets with the values that pertain to your app/project.
This is now built into CLI (finally):
In you your config.xml file-
Example:
Source:
https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/configparser/ConfigParser.js#L92Edit: (Cordova-Lib has since been moved)
https://github.com/apache/cordova-lib/blob/master/cordova-common/src/ConfigParser/ConfigParser.js#L109
Note: This has not been tested, but i think it should work.
After creating a new IOS platform in Cordova CLI, Edit the package name in the files below.
app/platforms/ios/<APP_NAME>/config.xml
app/platforms/ios/www/config.xml
To avoid an ugly complication, i suggest you try this first in a different Git Branch of your project.