universal-tools / UTNotificationsFeedback

7 stars 0 forks source link

Android 8 Colour #78

Closed vtimejc closed 6 years ago

vtimejc commented 6 years ago

Hi,

On my Oreo device (S8), notification icons become coloured when the notification area is dragged down.

How do I achieve this? I notice that androidIconBGColor is tagged as Android 5-7 only.

yuriy-universal-ivanov commented 6 years ago

Hi @vtimejc ,

Is it possible that you attach screenshot of what exactly you're talking about?

vtimejc commented 6 years ago

Hi @yuriy-universal-ivanov,

Here's a thread with some images that illustrate what I am talking about: https://stackoverflow.com/questions/45874742/android-color-notification-icon

(on my app, the icon is always white, even though I have set androidIconBGColor)

yuriy-universal-ivanov commented 6 years ago

Before Android API 26 (8.0), setColor was used to specify a small icon background, but since 8.0 its behavior has changed - you can't specify the small icon background. See https://developer.android.com/reference/android/app/Notification.Builder.html#setColorized(boolean).

Android 8 chooses a suitable contrast color for a notification icon, so it's easily seen against each background (the color is different depending on the current background).

image image image

If you really want to specify the color, you might use setColorized on Android 8 (you'll have to modify the UTNotifications native plugin).

vtimejc commented 6 years ago

Hmm, odd. Do you know how it decides the automatic colour? e.g.

2018-04-18 22 16 55_3

yuriy-universal-ivanov commented 6 years ago

Hi @vtimejc,

Be default it's gray on a light background and white on a dark. You can specify a custom color with setColorized on Android O+. Please write me to universal.tools.contact@gmail.com and I'll send you a patch enabling using the color specified in the notification profile settings in the Android O+ titles.

vtimejc commented 6 years ago

Thanks for all your help!