i would like to change default name of the installation package from default com.ionicframework.starter
to com.something.something
, how can i do it safe
This is what I did,
- Change the package name in config.xml
- enter "ionic repair"
That's it.
It removes/adds platform, removes/adds node packages and does other stuff, but everything will be automatic.
You should make this change in the config.xml found at the root of your project. For example you might have something like this:
<widget id="com.ionicframework.exampleproject223738" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
Change the id to whatever you wish your package to be and it will work for the entire project, Android and iOS.
However, if you've already submitted to the app store with a package name, you cannot change the package name at this point. Not unless you want to submit a new project. Updates must be made with matching package names.
Regards,
All I did was: a) Go to MainProjectFolder -> config.xml and find the line which says
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
b) Change the io.ionic.starter to com.myproject.mobile (reverse domain - that's what they call it, right)
c) Save the file.
d) Delete the platforms folder.
e) Open the command prompt and
- platform add android
- build android
-> build --release android
-> generate key using keytool
-> sign the apk using jarsigner
-> optimize the code using zipalign (for great documentation on these commands, refer: https://ionicframework.com/docs/v1/guide/publishing.html.
f) This process takes the package name from the config.xml file and build the apk from scratch thus eliminating the need for resetting any plugins as suggested. But I am new to this. May be there are other implications which experienced guys might point at. But this worked very well for me and I have deployed my first mobile app onto Google Playstore successfully.
Hope this helps.
Changing the package name in config.xml is the first step, there are other steps that need to be done to address the op's question about 'safely' changing the package name.
@ananth has given the practical answer. However it can be further simplified as I have tested and verified on Ionic 3.
ionic cordova platform rm <platform>
ionic cordova platform add <platform>
One should just update the package name in config.xml and reinstall all the plugins ionic state reset -- plugins ; caution ensure all the plugins are listed in package.json.