I do not understand why not detect that the sensor does not exist.
I tried to use it on a mobile phone without light sensor but warns me.
B4X:
p.Initialize(p.TYPE_LIGHT)
a.StartListening("a")
If p.StartListening("p") = False Then
Msgbox("Your device does not have the sensor","Warning")
Return
End If
According to the native API this method should only return true if the sensor is supported and enabled. Apparently your device doesn't return the "correct" result.