Android Question Always on Display - Notification Icon [Huawei Mate 20 Pro]

Nerdworld

Member
Licensed User
Longtime User
Hey folks!

I'm currently running into an issue with one of my apps:

- My app has a constant notification for a running service
- On my old phone (Samsung Galaxy S7 Edge) i had a small version of my app icon on the "always on"-display.
- On my new phone (Huawei Mate 20 Pro) there is a small green rectangle instead of an icon
- There is no problem with the "normal" notification bar, the icon is shown properly.

I've already tried to use different methods of creating the notification (e.g. librarys, notification builder etc.), without success.

Best regards
Daniel
 

Attachments

  • icon.jpg
    icon.jpg
    86.9 KB · Views: 301
Last edited:

Nerdworld

Member
Licensed User
Longtime User
Not sure that I understand. Is the problem the way the icon looks? Can you upload the icon file?

I tried several icon files, none of them are working - they are all displayed as a green rectangle (on my always-on-display).
They are working absolutly fine everywhere else (notification bar, app drawer, ...).

I'm using B4A 8.30.
 

Attachments

  • Moon.png
    Moon.png
    25.2 KB · Views: 251
Upvote 0

Nerdworld

Member
Licensed User
Longtime User
I

It's not just ignoring the colors, it's just displaying a green rectangle instead of the icon (see the photo on my first post).
Other icons (e.g. WhatsApp) are displayed fine.

I also tried using a black and white-version, a smaller version and different versions with transparent / intransparent background.
 
Upvote 0

Nerdworld

Member
Licensed User
Longtime User
The icon should act like a mask. Delete your icon and test it with the default icon. Does it work better?

The default icon isn't working as well - while the B4A-bridge icon is displayed correctly (A with a small tick).
 
Upvote 0

Nerdworld

Member
Licensed User
Longtime User
B4X:
Dim Notif As Notification : Notif.Initialize
Notif.Icon = "icon"
Notif.OnGoingEvent = True
Notif.SetInfo("Luna", "", Main)

Alternative version:

B4X:
Dim smiley As Bitmap = LoadBitmapResize(File.DirAssets, "test.png", 24dip, 24dip, False)
Dim Notif As NB6
Notif.Initialize("default", Application.LabelName, "DEFAULT")
Notif.SmallIcon(smiley)
Dim NotifObj As Notification = Notif.Build("Luna", "", "tag1", Main)
 

Attachments

  • 9015624e65eb0dc28c724ef2b1ffa90b.jpg
    9015624e65eb0dc28c724ef2b1ffa90b.jpg
    88.1 KB · Views: 241
Upvote 0

Nerdworld

Member
Licensed User
Longtime User
I don't see your icon in the screenshot.
I'm also not sure that the green box is your icon on the lock screen. Where is B4A-Bridge icon there?

I'm using the default icon in the screenshot (blue icon).
I'm 100% sure it is the green box on my rectangle - i can literally turn it on and off my closing my apps notification.

Edit: i also uploaded it with my own icon, here:
 

Attachments

  • a3a6817606e072b6e357c34043b4bb06.jpg
    a3a6817606e072b6e357c34043b4bb06.jpg
    73.1 KB · Views: 225
Upvote 0

Nerdworld

Member
Licensed User
Longtime User
Where is B4A-Bridge icon on the lock screen?

Can you upload a small project with the notification code and icon?

The Mate 20 Pro has a notch, so it's not always displaying all icons in the upper notification bar - but it's indeed displaying everything on the always-on-display.

I've created a new project with a notification - and now it's a small red line instead of a box.
 

Attachments

  • screen.jpg
    screen.jpg
    9.5 KB · Views: 264
  • TestApp.zip
    416.8 KB · Views: 239
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You should use File - Export as zip when uploading projects.

Your code is wrong. If you set the automatic foreground mode to ALWAYS then you shouldn't call StartForeground yourself.

Better to test it with:
B4X:
Dim Notif As Notification : Notif.Initialize
Notif.Icon = "icon"
Notif.OnGoingEvent = True
Notif.SetInfo("Luna", "", Me)
Notif.Notify(1)
Service.StartForeground(1, Notif)

I guess that the result will be the same. You will need to play with icons with different sizes.
 
Upvote 0
Top