IBM Worklight 5.0.5.2 - How to change the Android

2019-07-09 18:17发布

问题:

In worklight it seems that the android package name is set by the varible ${packageName}.

Where is this variable set? And how can I change it?

Right now the default seems to be com.applicationName.
In the app im working on, this package name already exists in Google Play, so I would like to change it to com.corperationName.applicationName.

I know I can do this via Ant during Android project compilation, but I was wondering if there was somewhere within Worklight I can do this.

回答1:

I was able to do this for Shell and Inner projects by making the following changes to the Shell project (check in or backup the shell and test before committing changes):

  • Add the following dir structure to the ShellApp/android/native/src directory: com/corpname/{$appName}
  • Copy the contents of the ${packageDirectory} directory into the new {$appName} directory (for me it was ${appName}.java.wltemplate.wluser, ForegroundService.java.wltemplate, GCMIntentService.java.wltemplate).
  • In the files copied, every reference to ${packageName} needs to be replaced with com.corpname.{$appName}
  • In AndroidManifest.xml.wltemplate.wluser, every reference to ${packageName} needs to be replaced with com.corpname.{$appName}.
  • Remove the ${packageDirectory} from the project.

Every inner project created from this Shell project should now have the package structure as com.corpname.appname