Behzad Azizan
Behzad Azizan

Reputation: 261

How to change Cordova application icon?

I designed an icon in 4 standard sizes : hdpi, ldpi, mdpi and xhdpi.

I put these icons into :

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

How can I use these icons as my application icon?

Upvotes: 9

Views: 33095

Answers (4)

DEV Tiago França
DEV Tiago França

Reputation: 1696

put your logo file named logo.png inside www/img dir

On config.xml file add:

<icon src="www/img/logo.png"/>

Upvotes: 1

<platform name="android">


<icon src="icon.png" platform="ios" width="147" height="147" density="mdpi"/>     



</platform>

Upvotes: 0

laughingpine
laughingpine

Reputation: 1049

The answer may vary based on your version of Cordova, but as of Cordova 3.5.0, this is the way of adding icons to your project. As mentioned in my comment, see the official docs for the source.

First create a folder for your icons to live. This will vary depending on your platform, since we are dealing with Android in your case, an assets folder will do nicely. It is easiest to create this in the project root (i.e. with the www/ hooks/ folders, config.xml file etc.)

While this won't impact you, it might be good to note. There is a small BlackBerry quirk regarding icons and splash screens. For BB10 you must place your assets folder in the www/ directory.

Drop your icons in there and add something along these lines to your config.xml file, 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>

Lastly, you can verify these worked after your build by checking the platforms\android\res\drawable- folders. They will contain an icon.png file that was copied across from your source directory during the build.

Upvotes: 19

tayyab islam
tayyab islam

Reputation: 41

Add a folder res in app and create folder in it icons/android 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>

Upvotes: 4

Related Questions