Hi all
I am referring to this (old) post:
https://www.b4x.com/android/forum/threads/kitkat-step-detector.40563/#post-242811, and the lines suggested by Erel :
When I execute the sensors exemple with these 2 lines added, the step counter always displays a fixed value while Accelerometer, Gyrocope, Light etc... have changing values :
TYPE_STEP_COUNTER = 369,031
What is wrong please ?
NB : Of course, I walked during the test
I am referring to this (old) post:
https://www.b4x.com/android/forum/threads/kitkat-step-detector.40563/#post-242811, and the lines suggested by Erel :
B4X:
AddSensor(18, "TYPE_STEP_DETECTOR", False)
AddSensor(19, "TYPE_STEP_COUNTER", False)
When I execute the sensors exemple with these 2 lines added, the step counter always displays a fixed value while Accelerometer, Gyrocope, Light etc... have changing values :
TYPE_STEP_COUNTER = 369,031
B4X:
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
SensorsMap.Initialize
Dim ps As PhoneSensors 'This object is only used to access the type constants.
AddSensor(ps.TYPE_ACCELEROMETER, "ACCELEROMETER", True)
AddSensor(ps.TYPE_GYROSCOPE, "GYROSCOPE", True)
AddSensor(ps.TYPE_LIGHT, "LIGHT", False)
AddSensor(ps.TYPE_MAGNETIC_FIELD, "MAGNETIC", True)
AddSensor(ps.TYPE_ORIENTATION, "ORIENTATION", True)
AddSensor(ps.TYPE_PRESSURE, "PRESSURE", False)
AddSensor(ps.TYPE_PROXIMITY, "PROXIMITY", False)
AddSensor(ps.TYPE_TEMPERATURE, "TEMPERATURE", False)
AddSensor(18, "TYPE_STEP_DETECTOR", False)
AddSensor(19, "TYPE_STEP_COUNTER", False)
End If
For i = 0 To SensorsMap.Size - 1
Dim ps As PhoneSensors
ps = SensorsMap.GetKeyAt(i)
Dim lbl As Label
lbl.Initialize("")
lbl.TextColor = Colors.White
Activity.AddView(lbl, 10dip, 10dip + 50dip * i, 100%x - 10dip, 45dip)
SensorsLabels.Put(ps, lbl)
Next
End Sub
What is wrong please ?
NB : Of course, I walked during the test