Android Question [Solved] NB6 icon not showing on lock screen (only the white circle)

walt61

Active Member
Licensed User
Longtime User
I'm puzzled - not for the first time, certainly not for the last. My device is a Moto X Style running Android 7.0 and the app is compiled with B4A 9.50. When I use B4A Bridge, the notification icon shows properly on the lock screen; B4A Bridge doesn't use NB6 (NotificationBuilder) for notifications (no idea whether this is relevant, but I need NB6 in my apps).

When using NB6, all I get is the white circle but without the icon inside it. Attached is a trimmed-down version of the NB6 example app that demonstrates the behaviour I'm seeing:
- click the entry in the CustomListView (there's only one) - this calls 'HighPriority_Timer_Notification' in the Starter Service (partial lock is set in Activity_Resume), which starts a Timer; when the Timer will tick, it will show the notification
- immediately put the device on lock screen
- wait 10 seconds
- the notification then arrives on the lock screen, but without the icon; only the white circle is showing

Am I misunderstanding something or am I doing something wrong (or both)?

Thanks in advance for any tips you might be able to offer!
 

Attachments

  • NB6test.zip
    24.3 KB · Views: 258

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is what I see:

i_view64_D9i52wkuw9.png


Looks correct.

Why use a timer???
B4X:
Sub HighPriority_Timer_Notification
    timer1.Enabled = True ' Wait 10 seconds so that after clicking the clv entry so that the user can put the device on lock screen
End Sub

Sub Timer1_Tick
    timer1.Enabled = False
    Dim n As NB6
    n.Initialize("default", Application.LabelName, "HIGH", True).SmallIcon(Main.smiley)
    n.Build("Important!!!", "Timed", "tag", Me).Notify(12)
End Sub

Better:
B4X:
Sub HighPriority_Timer_Notification
  Sleep(10000)
    Dim n As NB6
    n.Initialize("default", Application.LabelName, "HIGH", True).SmallIcon(Main.smiley)
    n.Build("Important!!!", "Timed", "tag", Me).Notify(12)
End Sub
 
Upvote 0

walt61

Active Member
Licensed User
Longtime User
Thanks as always Erel, and for the hint as well. After some further digging I found out that what I was seeing was caused by settings in the 'Moto' app (which I had completely ignored until now).

In case anyone else would have a strange experience with 'ambient' notifications on a Moto device and wants to disable this:
- open the Moto app
- tap its top-right corner
- tap 'Display'
- and then switch the 'Battery-friendly notifications...' off
 
Upvote 0
Top