How to count Steps in Android Programming?-VBForums
Results 1 to 4 of 4

Thread: How to count Steps in Android Programming?

  1. #1

    Thread Starter
    Banned
    Join Date
    Nov 2016
    Location
    dehradun
    Posts
    4

    Post How to count Steps in Android Programming?

    I am a developer. I have been searching for mobile development forum which can help me in learning the latest Android development features including Apps development. I want to figure out how we can count and detect steps in Android programming including sensors. I have searched alot of forums for my issue. I hope any tech developer can help me in resolving the issue.

  2. #2
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,531

    Re: How to count Steps in Android Programming?

    out of curiousity, did you post something about this in an ivy tech forum last semester?

  3. #3
    Registered User
    Join Date
    Mar 2017
    Posts
    1

    Re: How to count Steps in Android Programming?

    Step Counter: This keeps a count of the number of steps that you have taken. The counter is only reset when you re-boot the device, else, for every step you take (or the phone thinks you took, you counts up).
    Step Detector: This sensor just detects when you take a step. That’s it.

    // Step Counter
    sManager.registerListener(new SensorEventListener() {
    @Override
    public void onSensorChanged(SensorEvent event) {
    float steps = event.values[0];
    textViewStepCounter.setText((int) steps + “”);
    }
    @Override
    public void onAccuracyChanged(Sensor sensor, int accuracy) {
    }
    }, sManager.getDefaultSensor(Sensor.TYPE_STEP_COUNTER),
    SensorManager.SENSOR_DELAY_UI);


    // Step Detector
    sManager.registerListener(new SensorEventListener() {
    @Override
    public void onSensorChanged(SensorEvent event) {
    // Time is in nanoseconds, convert to millis
    timestamp = event.timestamp / 1000000;
    }
    @Override
    public void onAccuracyChanged(Sensor sensor, int accuracy) {
    }
    }, sManager.getDefaultSensor(Sensor.TYPE_STEP_DETECTOR),
    SensorManager.SENSOR_DELAY_UI);

  4. #4
    New Member
    Join Date
    Dec 2010
    Posts
    8

    Re: How to count Steps in Android Programming?

    Working with sensors in B4A: https://www.b4x.com/android/forum/th....6647/#content

    You need to pass 19 (TYPE_STEP_COUNTER) for the SensorType parameter. Note that it is only supported by Android 4.4+.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.