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

Nerdworld

Member
Licensed 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

Last edited:

Erel

Administrator
Staff member
Licensed User
Not sure that I understand. Is the problem the way the icon looks? Can you upload the icon file?
 

Nerdworld

Member
Licensed 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

Nerdworld

Member
Licensed 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.
 

Erel

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

Nerdworld

Member
Licensed 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).
 

Erel

Administrator
Staff member
Licensed User
1. Post the code that creates the notification.

2. Post a screenshot of the device while it is unlocked and the icon should appear at the top.
 

Nerdworld

Member
Licensed 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

Erel

Administrator
Staff member
Licensed 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?
 

Nerdworld

Member
Licensed 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

Erel

Administrator
Staff member
Licensed User
Where is B4A-Bridge icon on the lock screen?

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

Nerdworld

Member
Licensed 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

Erel

Administrator
Staff member
Licensed 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.
 
Top