Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova: How to set different package names per platform using the cordova-cli?

I have an app for iOS and Android that I am upgrading from PhoneGap 2.x to Cordova 4.0.

As the iOS and Android apps were created using PhoneGap 2.x I have two separate projects (i.e. a project for iOS and a project for Android). These projects have a shared www directory (using symbolic links) for the HTML/CSS/JavaScript assets. When I upgrade to Cordova 4.0 I can have a single Cordova project and use the Cordova CLI to create projects for each platform in the platforms directory.

The package name that is used to for each platform in Cordova is set in shared a config.xml file though. The Cordova CLI uses the package name set in the config.xml for the perpare, build and add platform commands.

Unfortunately the package names that were used for the PhoneGap 2.x apps are not the same (i.e. the package name for the Android app is different to the package name of the iOS app).

For example: the Android app has a package name like com.example.applongname but the iOS app has a package name like com.example.AppShortName. The beginning of the package name (i.e. reverse company domain name) is the same for each app but the application names differ. The iOS application name also contains capital letters.

I need to keep the package names that were used for the initial PhoneGap 2.x builds so that the apps can be updated (i.e the end users can receive an update that will replace their existing install of my app).

How I can set the package name per platform without creating two separate projects?

like image 471
user3620741 Avatar asked Nov 27 '14 09:11

user3620741


People also ask

What are the different platforms supported by cordova?

Supported platforms As of version 9, Apache Cordova currently supports development for the operating systems Apple iOS, Google Android, Windows 8.1, Windows Phone 8.1 , Windows 10 and Electron (software framework) (which in turn runs on Windows, Linux and macOS).

What software packages are used for the installation of cordova?

You can install the Cordova module by using the Node Package Manager(npm), utility of Node. js. This module will automatically be downloaded from the npm utility of Node.

Which cordova introduce cordova CLI?

Cordova 3.0 is the first version to support the command-line interface described in this section.


1 Answers

Write widget this way:

<widget id="com.company.app" android-packageName="com.company.androidapp" ios-CFBundleIdentifier="com.company.iosapp" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

see my other answer for more details.

like image 151
Aks Avatar answered Sep 19 '22 02:09

Aks