Push notification icon in ionic app?

I am trying to set icon for push notification. When a notification arrives, I want my logo to appear in the notifiation bar. How is this possible in ionic?

While sending data to gcm :

I set param largeIcon as ‘http://www.someurl.net/images/logo-icon.png’ and smallicon as ‘http://www.someurl.net/images/logo-icon.png . It doesnt work.

I got this link but it is still a little vague about how to actually generate icons and place in a directory.

Can anybody tell me how to set notification icon in notification bar?

@rintuzi123
nope. Do i need to add something in my config.xml for notifications?

icon src=“urrl to ur icon image file”

I am talking about notification icon that appears on the notification bar. Not the main app icon. I hope I am clear.

if you are using the phonegap push plugin you can set the icon on initialization

but i do not tested this, yet

In my case I’m not assigning any image url from sever side when sending data to GCM. And for notification my app takes the default icon of the app that I set in config. You can have a try.

this is part of my config.xml.

Do you think i need to add anything? is there any specific doc that addresses this issue?

<icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/>
<icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/>
<icon src="resources/android/icon/drawable-hdpi-icon.png" density="hdpi"/>
<icon src="resources/android/icon/drawable-xhdpi-icon.png" density="xhdpi"/>
<icon src="resources/android/icon/drawable-xxhdpi-icon.png" density="xxhdpi"/>
<icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
<splash src="resources/android/splash/drawable-land-ldpi-screen.png" density="land-ldpi"/>
<splash src="resources/android/splash/drawable-land-mdpi-screen.png" density="land-mdpi"/>
<splash src="resources/android/splash/drawable-land-hdpi-screen.png" density="land-hdpi"/>
<splash src="resources/android/splash/drawable-land-xhdpi-screen.png" density="land-xhdpi"/>
<splash src="resources/android/splash/drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/>
<splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
<splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
<splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/>
<splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
<splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>

What if you don’t set any param for icon at sever side? Are you able to view any icon on notification without setting any param for icon?
In my config I simply set the icon tag like <icon src="img/icon.png">. And I’m able to shot out the issue.

well it does appear, but I think icons are to be provided in different resolutions (hdpi,ldpi,mdpi). Or is it okay if we provide only one simple ??

http://romannurik.github.io/AndroidAssetStudio/icons-notification.html will take care of creating the right formats.

2 Likes