Hi,
I am using the TYPE_ACCELEROMETER and have noticed that some devices won't accept Initialize2 values.
For example: I use a service to study the best way to collect the sensor's value. I wanted to check which sensors delay would be the best.
For that I have an EditText feeding the tSpeed and coming from the Main activity. Before each change, I stop my service. Than I restart it.
What I have noticed : the Moto G accepts only one time change of value. It starts at 0 but if I change to 3, the sensor won't send data... While a noname phone accepts many changes of values.
But when the sensor is blocked, it is never considered as defected (MaxValue never reaches -1).
So my question is : does it exist a way to be sure to be able to collect data ? Many thanks
I am using the TYPE_ACCELEROMETER and have noticed that some devices won't accept Initialize2 values.
For example: I use a service to study the best way to collect the sensor's value. I wanted to check which sensors delay would be the best.
For that I have an EditText feeding the tSpeed and coming from the Main activity. Before each change, I stop my service. Than I restart it.
What I have noticed : the Moto G accepts only one time change of value. It starts at 0 but if I change to 3, the sensor won't send data... While a noname phone accepts many changes of values.
But when the sensor is blocked, it is never considered as defected (MaxValue never reaches -1).
So my question is : does it exist a way to be sure to be able to collect data ? Many thanks
B4X:
Sub Process_Globals
Dim Sensor As PhoneSensors
End Sub
Sub Service_Create
Dim tTemp As Int =Main.tSpeed 'this is a Variable charged with values from 0 to 3
Log("tTemp Value: " & tTemp)
Sensor.Initialize2(Sensor.TYPE_ACCELEROMETER,tTemp)
End Sub
Sub Service_Start
Sensor.StartListening("sensor")
if Sensor.MaxValue=-1 Then Log("Sensor not working")
End Sub
Sub Service_Destroy
Sensor.StopListening
Log("Service stopped")
End Sub
Sub sensor_SensorChanged (Values() As Float)
Log(Values())
End Sub