How do I change the Cordova app icon?

I developed icon in 4 standard sizes: hdpi

, ldpi

, mdpi

and xhdpi

. I put these icons in:

  • "\platforms\android\res\drawable-hdpi"

  • "\platforms\android\res\drawable-ldpi"

  • "\platforms\android\res\drawable-mdpi"

  • "\platforms\android\res\drawable-xhdpi"

    ...

The name of each icon is "icon.jpg".

How can I use these icons as my app icon?

+3


source to share


2 answers


The answer may differ depending on your version of Cordova, but as with Cordova 3.5.0, this is the way to add icons to your project. As mentioned in my comment, refer to the official docs for the source.

First create a folder for your icons to live. It depends on your platform, since we are dealing with Android in your case, the folder assets

will be fine. This is easiest to create at the root of the project (i.e. With folders www/

hooks/

, config.xml

etc.)

As long as it doesn't affect you, it might be good to notice. There is a slight BlackBerry quirk with icons and splash screens. For BB10, you must put your assets folder in a directory www/

.



Ditch your icons and add something along these lines to your file config.xml

where the pngs correspond to your icons:

<platform name="android">    
    <icon src="assets/mdpi.png" density="mdpi" />
    <icon src="assets/ldpi.png" density="ldpi" />
    <icon src="assets/hdpi.png" density="hdpi" />
    <icon src="assets/xdpi.png" density="xhdpi" />
    <icon src="assets/xxdpi.png" density="xxhdpi" />
</platform>

      

Finally, you can check these works after build by checking the folders platforms\android\res\drawable-

. They will contain the file icon.png

that was copied from the source directory at build time.

+8


source


Add res folder to app and create icons / android folder in it and save images there



<platform name="android">
    <icon src="res/icons/android/icon-36-ldpi.png" density="ldpi"/>
    <icon src="res/icons/android/icon-48-mdpi.png" density="mdpi"/>
    <icon src="res/icons/android/icon-72-hdpi.png" density="hdpi"/>
    <icon src="res/icons/android/icon-96-xhdpi.png" density="xhdpi"/>
</platform>

      

+2


source







All Articles