I'm trying to use it to turn off the screen when the proximity sensor reads something is close to it/turn it back on when the proximity sensor no longer reads the object.
I'm using
Inside a code module, cause when I try the same code within an activity module it won't let me use SetScreenBrightness, just Initialize, InitializeWithPhoneState and StopListening. And it won't work inside a service module as per the documentation.
When an object is close the proximity sensor reads 0 so I use SetScreenBrightness(0) and when an object isn't close it reads mysensor.MaxValue so I use SetScreenBrightness(-1) which should be automatic brightness
And I get:
java.lang.NullPointerException
at anywheresoftware.b4a.phone.Phone.SetScreenBrightness(Phone.java:183)
Caused by: java.lang.NullPointerException
at anywheresoftware.b4a.phone.Phone.SetScreenBrightness(Phone.java:183)
I'm using
B4X:
Sub SetScreenBrightness(Value As Float)
Dim phone1 As Phone
phone1.SetScreenBrightness(Value)
End Sub
Inside a code module, cause when I try the same code within an activity module it won't let me use SetScreenBrightness, just Initialize, InitializeWithPhoneState and StopListening. And it won't work inside a service module as per the documentation.
When an object is close the proximity sensor reads 0 so I use SetScreenBrightness(0) and when an object isn't close it reads mysensor.MaxValue so I use SetScreenBrightness(-1) which should be automatic brightness
And I get:
java.lang.NullPointerException
at anywheresoftware.b4a.phone.Phone.SetScreenBrightness(Phone.java:183)
Caused by: java.lang.NullPointerException
at anywheresoftware.b4a.phone.Phone.SetScreenBrightness(Phone.java:183)