Android Push Notification Icon

@Brent

I found the icon will show if I change all the notification icon to black and white only. How can I support color notification icon?

It shows a gray circle background with a small icon in the middle. It doesn’t look like a normal notification icon I saw from other app. I attached the icon I want. It should have the app icon + the notification icon.

Thanks!

Hi @apps30,

Although the Google documentation is long, there are some very important points mentioned. In specific:

  • Status bar icons are composed simply of white pixels on a transparent backdrop , with alpha blending used for smooth edges and internal texture where appropriate.
  • Status bar icons are flat, pictured face on, and must be white on a transparent background.

So basically, Google wants you to follow their guidelines… and if you don’t, they’re liable to reject your app when submitted to Google Play.

Best regards,

Brent

Hi Brent,

I saw the google documentation. Notification icon is purely gray and white. I think that is okay for status bar icon. However, for the notification icon in the popup dialog, the screenshot I attached, is showing the app icon (I think) + a small notification icon in the bottom left. 

So, the black and white notification is still there (I think should be still under the google guideline). I should change my question to: how (or is it possible) to add app icon behind the notification icon in the popup dialog like my attached screenshot from other app.

Also, some of the app can have difference background color of the notification icon like gmail icon is in red background not gray. Is it possible to change this color as well? is it a setting in corona? 

Edit:

I found this document: https://fcm.googleapis.com/fcm/send

it supports “color” and “icon” parameters. The icon parameter doesn’t look like is an image path on the server.  And I tried to set the color value to “#ff0000” but it doesn’t work.

Thanks!

Hi @apps30,

What plugin/service are you using on for push notifcations? Not the server-side stuff, but what handles the notifications on the device side…

Brent

        [“plugin.notifications”] =

        {

            publisherId = “com.coronalabs”

        },

Corona doesn’t use the app icon as the “large” notification icon on Android.  In fact, we never apply a “large” notification icon.  The notification icons you provide are used as the “small” notification icon that you see in the top status bar, and since we never apply a large icon, the Android OS scales up this small notification icon in the notification list.  I’ve confirmed that this is how it works on Android 7.0 and older OS versions.

Also, you cannot set the notification icon via an HTTP request like you’re doing.  You hard code them on the app’s end by adding PNGs to your project as documented here…

   https://docs.coronalabs.com/guide/events/appNotification/index.html#android-icons

So, if you are seeing your app icon in the notification list then this tells me one of the following is happening:

  • You’re using a 3rd party notification library and not Corona’s notifications plugin/feature.  If you are using a 3rd party plugin, then you have to follow that plugin’s documentation instead.
  • Your device is a fork of the Android OS (non-standard) and it doesn’t following Google’s documented rules.

I also recommend that you try running Corona’s sample project “System/LocalNotifications” that is included with the Corona Simulator.  That project will post Corona’s default notification icon to the status bar, which looks like a triangle with an exclamation mark in it.

Thanks for the detail reply. Do you know any 3rd party notification library can do this?

I think you’re missing my point.

Corona’s notification feature does NOT use the app icon for notifications.

Trust me.  I know.  I’ve seen the code.  So, something unusual is happening here.

Try building the “System/LocalNotifications” sample project as-is and run it on your Android device.  Tap the “Start With Time” button and then press the Home button to see what the icon looks like in the status bar.

I am still seeing the triangle icon not the app icon in the “LocalNotifications” demo app.

Right. That’s how it’s supposed to work with Corona’s notifications feature.

Wait… are you saying you want to see the app icon in the notifications list?

yes. I think I found the answer. The OneSignal plugin can do what I want. I am trying to move all my notification to OneSignal now. Anyway, thanks for the help!