Android Question Count the very first steps with pedometer

Fillmore

Member
Licensed User
Longtime User
Hi,

When I use the pedometer function, it doesn't count the 8 or 9 first steps. But I need to know exactly how many steps a runner have done. How can I do to activate the step counter on the very first step ?
Hope you understand... Not really fluant in english...

Thanks a lot.

Fred
 

Servaas

Member
Licensed User
Can any of you tell me why won't this trigger?

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim Pedometer 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.
    Private Label1 As Label
    Private Label3 As Label
    Private Label2 As Label
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("main")
    If FirstTime Then
        Pedometer.Initialize(19)
    End If
End Sub

Sub Activity_Resume
    If Pedometer.StartListening ("19") = False Then
        Label1.Text = "Pedometer not supported!"
    End If

End Sub

Sub Activity_Pause (UserClosed As Boolean)
Pedometer.StopListening
End Sub


Sub Pedometer_SensorChanged (Values() As Float)
    If Sender = 19 Then
        Label1.Text = NumberFormat((0), 0, 3)
        Else
            Label1.Text = "Somethings wrong"
    End If
End Sub
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Can any of you tell me why won't this trigger?

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim Pedometer 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.
    Private Label1 As Label
    Private Label3 As Label
    Private Label2 As Label
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("main")
    If FirstTime Then
        Pedometer.Initialize(19)
    End If
End Sub

Sub Activity_Resume
    If Pedometer.StartListening ("19") = False Then
        Label1.Text = "Pedometer not supported!"
    End If

End Sub

Sub Activity_Pause (UserClosed As Boolean)
Pedometer.StopListening
End Sub


Sub Pedometer_SensorChanged (Values() As Float)
    If Sender = 19 Then
        Label1.Text = NumberFormat((0), 0, 3)
        Else
            Label1.Text = "Somethings wrong"
    End If
End Sub
Pls open new thread
 
Upvote 0
Top