1

My app is a voip app. I am using NotificationCompat.CallStyle in NotificationCompat.Builder. The smallIcon I gave in it does not appear. My phone is Android 13.

Also, the icon appears in the dark theme. Icon not visible without dark theme. Even if I give the light theme an irrelevant blue color, it doesn't show up.

There is only color difference between dark and light.

Dark theme color:

android:fillColor="#ffffff"

Light theme color:

android:fillColor="#000000"

My light baseline_phone_callback_24 icon:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">
  <path
      android:pathData="M20.156,3.703L13.828,9.984L18,9.984L18,11.016L12,11.016L12,5.016L12.984,5.016L12.984,9.281L19.453,3L20.156,3.703ZM6.609,10.781C8.109,13.688 10.313,15.891 13.219,17.391L15.422,15.188C15.734,14.875 16.078,14.797 16.453,14.953C17.578,15.328 18.766,15.516 20.016,15.516C20.297,15.516 20.531,15.609 20.719,15.797C20.906,15.984 21,16.219 21,16.5L21,20.016C21,20.297 20.906,20.531 20.719,20.719C20.531,20.906 20.297,21 20.016,21C15.328,21 11.32,19.336 7.992,16.008C4.664,12.68 3,8.672 3,3.984C3,3.703 3.094,3.469 3.281,3.281C3.469,3.094 3.703,3 3.984,3L7.5,3C7.781,3 8.016,3.094 8.203,3.281C8.391,3.469 8.484,3.703 8.484,3.984C8.484,5.234 8.672,6.422 9.047,7.547C9.172,7.953 9.094,8.297 8.813,8.578L6.609,10.781Z"
      android:strokeWidth="1"
      android:fillColor="#000000"
      android:fillType="nonZero"
      android:strokeColor="#00000000"/>
</vector>

My notification builder:

builder = new NotificationCompat.Builder(this, getNotificationChannel(type))
                        .setCategory(NotificationCompat.CATEGORY_CALL)
                        .setOngoing(true)
                        .setSmallIcon(R.drawable.baseline_phone_callback_24);
                        .setVisibility(NotificationCompat.VISIBILITY_PUBLIC);


Person person = Person person = new Person.Builder()
                .setName(friendName)
                .setImportant(true)
                .build();

builder.setStyle(CallStyle.forIncomingCall(person, pendingIntent1, pendingIntent2);

Screenshot: enter image description here

Dark theme:

enter image description here

propoLis
  • 1,229
  • 1
  • 14
  • 48

2 Answers2

1

If I get it right setSmallIcon(R.drawable.baseline_phone_callback_24) - is for status bar icon, and icon for caller is set inside Person

UPD: try to use setVerificationIcon with your Notification.CallStyle

hi.cosmonaut
  • 120
  • 1
  • 9
  • Oh, very thanx. I am using Person for the first time. I've given a setIcon to the Person, but the space still remains. Is this normal? I thought there would be an icon in that space. – propoLis Aug 01 '23 at 06:48
  • hi, I've updated my answer, try it and let me know if it works – hi.cosmonaut Aug 01 '23 at 07:47
  • Hello, thank you very much. I added what you said, but the icon was added to the right side, not in that space. I am attaching the updated screenshot – propoLis Aug 01 '23 at 07:53
  • and `Notification.CallStyle.setVerificationIcon(...)` doesn't work too? – hi.cosmonaut Aug 01 '23 at 07:59
  • Yeap I tried, just added icon to the right. Invisible empty space icon appears in dark theme – propoLis Aug 01 '23 at 08:13
  • oh, nice, try to split icons for dark and light themes. Just put light icon in `res\values-night\drawable` dir and dark icon in `res\values\drawable` dir. It will automatically change when you switch themes – hi.cosmonaut Aug 01 '23 at 08:16
  • I did what you said, but the icon there continues to not appear in the light theme. – propoLis Aug 01 '23 at 08:44
  • ok, can you attach two images (svg codes): for night theme and for day theme. I think android 13 redraw your icon because it has changes with icon appearance and monochomic feature – hi.cosmonaut Aug 01 '23 at 09:01
  • I updated my question. I just changed the color for themes – propoLis Aug 01 '23 at 11:09
  • Even if I give the light theme an irrelevant blue color, it doesn't show up. – propoLis Aug 01 '23 at 11:10
1

note that you are setting #7f7f7e color (gray), which isn't present anywhere, even on icon when visible. thats because system is getting your icon, takes non transparent pixels and exchanging them to white or black (monochromatic), depends on system UI, leaving transparent ones untouched

you may try to set full-black or full-white color, maybe thats help, but for me it looks like some bug in system which is always colouring icon to white, not taking care of dark theme set up

also: check if this problem happens on any other Android 13 device

snachmsm
  • 17,866
  • 3
  • 32
  • 74
  • It happened on Samsung android 13 devices. It hasn't happened on other devices I have. I made it full black in Light, I couldn't make the icon visible again – propoLis Aug 01 '23 at 11:07
  • Even if I give the light theme an irrelevant blue color, it doesn't show up. – propoLis Aug 01 '23 at 11:10
  • this icon will be white or will be black, no other option. color set up by you doesn't matter, system will change it. if this happens only on Samsung and not on other devices with Android 13 then it means that Samsung made some mistake on OS side, one and only option is to wait for an update... – snachmsm Aug 01 '23 at 11:26
  • Ok ,thank you. Then I'll wait for the update – propoLis Aug 01 '23 at 11:32