On Android I don't see the App Icon on my notifications what is the reason for this?

If Notifications are sending OK but you notice an issue on some devices such as newer Android 6.0 devices that the App icon not appearing on notifications just a blank square (see below).  Then you need to set a notification icon for your App.

 

Android introduced a new scheme with visual changes to notifications in Android 5.0 where you are encouraged to set an icon that is in keeping with their design guidelines. So this square icon is related to that. We provide a helper method in our SDK  so you can set an icon quickly it is in our docs here and the relevant extract is below:

Setting a Custom Notification Icon

In order to use Androids custom notification icon functionality, a new method can be used when creating the PushConnector instance, e.g.

mPushConnector = new PushConnector.Builder(AppId, GoogleProjectID)
    .setIcon("iconfilenamewithoutextension")
    .create(this);

This will set the icon for the notifications with an image from the res/drawablefolder of the app. In this example, the library will try to look for a file called iconfilenamewithoutextension.jpg or iconfilenamewithoutextension.png etc. in the res/drawable folder. If the file cannot be found, the default app icon will be used instead. 

If you do set an icon, the library will also search for a color entry with the same name in one of the XML files in the res/values to use as a background colour behind the icon. This entry could look like the following: 

<!-- color int as #AARRGGBB (alpha, red, green, blue) -->
<color name="iconfilenamewithoutextension">#ff2266ff</color>

This additional functionality caters for the notification icon scheme introduced in Lollipop, where the icons should be white only and have transparent sections for a background colour to show through (see https://developer.android.com/design/patterns/notifications.html#use_distinct_icons)

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.