Android Question b4a v8 notification led not working


Active Member
Licensed User
Hi, everyone

Just updated to B4A v8 - and it appears the notification Led/light has stopped working - I checked by going back to v7.8 and recompiling the same code and installing it on my device - and notification Led/light worked ok. So it does appear to be v8 related.

Anyone else had this problem, or as usual am I doing something wrong?


Active Member
Licensed User
Hi Erel

No I have only tried it on Andriod 6 and 4 devices. The code is in Service module, code sample below. The n.Light = true has just been added (but it makes no difference).

Thanks for the quick response

private Sub iNotifyMessage(inStrg As String)
    Dim n As Notification
    n.Icon = "icon"
    ' TODO See TaskSelect.pHandleMessage()
    Dim xmlStr As String = inStrg.SubString(ModEposApp.EPOS_MESSAGE.Length)
    Dim responseObj As clsMessageRec
    responseObj = responseObj.pXmlDeserialize(xmlStr)' TODO - need to determine if the deserialisation was successful
    n.Light = True
    n.SetInfo(responseObj.headingTop, responseObj.headingBottom, TaskSelect)
End Sub
Upvote 0


B4X founder
Staff member
Licensed User
Longtime User
It is fixed for the next update. For now you can use this workaround to enable the notification led:
Dim r As Reflector 'Reflection library
r.Target = n 'notification object
r.SetField("flags", Bit.Or(r.GetField("flags"), 1), "")

Call it before you call SetInfo. Note that on Android 8+ the behavior depends on the notification channel defaults.
Upvote 0