Hello
I want the actial light status of my room
so I made
But when i add Log (Values)to my program, it stopps
What i want is get the actual light in real time
I want the actial light status of my room
so I made
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim pSensor As PhoneSensors
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
pSensor.Initialize(pSensor.TYPE_LIGHT)
Log(pSensor.MaxValue)
If pSensor.StartListening("LightEvent")= True Then
Log("light sensor supported")
End If
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub LightEvent
Log(pSensor.MaxValue)
End Sub
Sub LightEvent_SensorChanged (Values() As Float)
Log (Values)
End Sub
What i want is get the actual light in real time
B4X:
Installing file.
PackageAdded: package:com.avestudio.ver
** Activity (main) Create, isFirst = true **
32768
light sensor supported
** Activity (main) Resume **
Error occurred on line: 47 (main)
java.lang.RuntimeException: Method: NumberToString not matched.
at anywheresoftware.b4a.shell.Shell.getMethod(Shell.java:424)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:484)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:229)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:157)
at anywheresoftware.b4a.phone.Phone$PhoneSensors$1.onSensorChanged(Phone.java:1088)
at android.hardware.SystemSensorManager$SensorEventQueue.dispatchSensorEvent(SystemSensorManager.java:418)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:138)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)