Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova hook to change the app name for iOS and Android

Tags:

cordova

I could not manage to have a space in the app name when generating the iOS target. Overriding the app name in the manifest (android) and in resources (ios) was fine, but changes are lost as soon as I rebuild the app (as it copies again the app name from config.xml).

I was thinking of creating a hook for that. Such hook would put the proper app name value for ios and android. Are there any sample hook that does such thing and is "before_compile" the proper timing for that?

like image 732
alextk Avatar asked Mar 15 '23 23:03

alextk


1 Answers

I created a hook to do exactly this. You can take a look at the github repo.

The plugin takes the display name as a variable when you add it and then updates the iOS plist on install and adds an after_prepare hook that sets app_name for Android so you don't run into the issue of your change being overwritten.

cordova plugin add cordova-plugin-app-name --variable APP_NAME="My Super Cool App" --save
like image 125
blakgeek Avatar answered Mar 24 '23 04:03

blakgeek