Custom icon for local notifications in Android

4 replies [Last post]
poon
User offline. Last seen 20 weeks 5 hours ago. Offline
Joined: 21 Sep 2011

Hi,

I love that we now have local notification support for Android! Walter's blog mentioned that in Android, we can use custom icons for the notification that appears in the notification tray.

Question – how do we specify the custom icon? The documentation at http://docs.coronalabs.com/api/library/system/scheduleNotification.html doesn’t say.

Thanks in advance,
Alex

Replies

attudesign
User offline. Last seen 24 weeks 3 days ago. Offline
Joined: 26 Apr 2011

I second that.. I was wondering that to.

We could use these local notifications to set up a type of push notification system for our apps. Run process in background, poll website.. etc

Not the most ideal way obviously... but I've given up on GCM ever being integrated..

but ya... Custom Icons

Joshua Quick
User offline. Last seen 1 year 27 weeks ago. Offline
Staff
Joined: 31 Jan 2011

I apologize. We haven't had time to document this yet. This is something that we were planning on doing once we've finished adding push notifications.

You can set up your own custom notification icon in a Corona project by adding the following files to the root of the project directory, like how you do it for application icons.

IconNotificationDefault-ldpi.png
IconNotificationDefault-ldpi-v9.png
IconNotificationDefault-ldpi-v11.png
IconNotificationDefault-mdpi.png
IconNotificationDefault-mdpi-v9.png
IconNotificationDefault-mdpi-v11.png
IconNotificationDefault-hdpi.png
IconNotificationDefault-hdpi-v9.png
IconNotificationDefault-hdpi-v11.png
IconNotificationDefault-xhdpi.png
IconNotificationDefault-xhdpi-v9.png
IconNotificationDefault-xhdpi-v11.png

Please note that different Android OS versions support different notification icon themes. You must support them all or else your app may get rejected during the app review process.

The "-v9" indicates that the PNG file represents an Android 2.3 icon. These icons are expected to be grey.
The "-v11" indicates that the PNG file represents an Android 3.0 or higher icon. These icons are expected to be white.
Icons without the postfix "-v" are used on Android 2.2. These icons are expected to be black.

See the link below for Google's official documentation on status bar icon sizes and theming.
http://developer.android.com/guide/practices/ui_guidelines/icon_design_status_bar.html

I hope this helps!

attudesign
User offline. Last seen 24 weeks 3 days ago. Offline
Joined: 26 Apr 2011

Joshua,

Thankyou.. I know all about the sizing and whatnot already but the link for everybody else is great.

Steve

poon
User offline. Last seen 20 weeks 5 hours ago. Offline
Joined: 21 Sep 2011

Thanks Joshua, we'll try it!

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.