Reputation: 3066
I have 5 test Android phones, each running a different version of OS (5.1, 6.1, 7.1,8 and 9). I get one of two different push notification icons to display - depending on OS version. My app icon is a hexagonal shape.
Samsung Grand Prime, 5.1.1 = real app icon - with colors
Samsung Galaxy S5, 6.0.1 = real app icon - with colors
LG K20 Plus, 7.0 = white hexagonal icon
LG K20 Plus, 8.0 = white hexagonal icon
Google Pixel 3a, 9.0 = white hexagonal icon
I am using cordova-plugin-firebasex (https://github.com/dpa99c/cordova-plugin-firebasex#android-notification-icons) and created all the appropriate notification_icon
s in the respective drawable folders (mdpi/hdpi/xdpi/xxhdpi/xxxhdpi) - the icons are all mini versions of my real app icon (with colors). I have read in many threads/blogs that above Lollipop (5.0) real app/color Icons are not possible for push notifications. However I have my real app/colored icon displaying as the push notification icon on the Android 5.1.1 and 6.1 test phones.
My questions are as follows:
If Android 5 and above are only transparent push notification icons - then how are those two test phones showing the real colored icon?
Is my understanding of this correct...OR is it possible to get real app icon to appear as push notification icon for Android 7, 8 and 9? If so...how? What else must I do beyond the standard steps defined in the above (also below) Firebasex directions?
If not possible...can anyone answer WHY Google stopped supporting color/real app push notification icons? iOS supports mini app icons as the push notification icon through all rev of their OS. The colored icons really help users know exactly what app just notified them without having to take any further action. A white icon is typically not very recognizable and makes it harder to discern which app just sent the message
If its not possible, then I will need to create transparent icons for 7, 8 & 9 - but how can I have the lower versions still show the real app icons and the uppers versions show the transparent icons? I have one base config.xml - what internal code would I need to add to test for different versions to supply real icon vs transparent icon?
The current config.xml
configuration is to define push notification icons is:
<platform name="android">
<resource-file src="res/android/drawable-mdpi/notification_icon.png" target="app/src/main/res/drawable-mdpi/notification_icon.png" />
<resource-file src="res/android/drawable-hdpi/notification_icon.png" target="app/src/main/res/drawable-hdpi/notification_icon.png" />
<resource-file src="res/android/drawable-xhdpi/notification_icon.png" target="app/src/main/res/drawable-xhdpi/notification_icon.png" />
<resource-file src="res/android/drawable-xxhdpi/notification_icon.png" target="app/src/main/res/drawable-xxhdpi/notification_icon.png" />
<resource-file src="res/android/drawable-xxxhdpi/notification_icon.png" target="app/src/main/res/drawable-xxxhdpi/notification_icon.png" />
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />
</config-file>
</platform>
Again, the notification_icon
in each of the drawable folders is an appropriate sized mini version of my real app/colored icon.
Upvotes: 1
Views: 2626
Reputation: 2956
Because they allowed certain time lapse for developers to update their apps. This time ran out when Android 7 was launched. However, while in those phones you may see the colored icon on the notification bar, you are surely getting a white icon contour only in the detailed notification panel (starting w/Android 5)
You can't. You should use a white icon with PNG transparency together with the color
push payload value to get the white icon with your colored background in the detailed notifications panel.
I guess they stopped supporting this because developers tend to create extremely ugly icons, which in small size (18x18 or so) look even worse. In this case it's better to see the icon contour only, also more aesthetically consistent... this is more reasonble than asking developers to design icons with the same style and guidelines. The key here is to have a proper logo, simple but unique, without much detail. Consider the "f" icon from Facebook, or the envelope from Gmail: those icons can always be identified and associated withe the corresponding app even in monochrome palette. If your logo needs a 256x256 resolution to fit all its detail, it's time to call a graphic designer to create a new logo.
The only way to show different icons for different Android versions, is to change the icon
payload on the server side before sending the push. You can (and should) save the Android OS version together with your push registration ID for each user. However, I wouldn't recommend you to proceed with this idea of different icons because:
Regarding that last point, users in Android 4 won't see the bg color you set in your push, they'll see the PNG transparency icon with the default black background.
I hope my post threw some light to all your push icon doubts, let me know otherwise.
Upvotes: 4