Notification action icon was not showing

I am trying to show a notification on Android and use the code from this link . In some sources, people said that the icon should be completely white, and some source said that I should use .png instead of vector.

I try all of this, but nobody helped me.

I am trying this code:

Notification newMessageNotification =
    new Notification.Builder(mContext)
            .setSmallIcon(R.drawable.ic_message)
            .setContentTitle(getString(R.string.title))
            .setContentText(getString(R.string.content))
            .addAction(action))
            .build();

      

+3


source to share


3 answers


after searching for about 1 hour in the whole question with this theme, finally i recognize it because of my android version! look at the image below. At Api level 24 above, there is no icon in the design.



Snapshot Android N notifications

+3


source


With Nougat, they redesigned the notification icons

https://android-developers.googleblog.com/2016/06/notifications-in-android-n.html



You will notice that icons are missing in new notifications; instead, more space is provided for the labels themselves for the limited space of notification shadows. However, notification action icons are still required and continue to be used in older versions of Android and on devices like Android Wear.

+1


source


Notification icons must be completely white

If you want to support Lollipop Material Icons then create transparent icons for Lollipop and above . Please refer to https://design.google.com/icons/

0


source







All Articles