0

I am working on a delivery app that the company charges clients based on the number of stairs that the delivery agent has to climb. It's probable that the agent cheats and collects the stair fee in cash without reporting it to the company.

I wanted to know if there is anything that can help the app detect if the delivery agent has climbed any stairs or not.

  • 1
    Can you try https://github.com/StasDoskalenko/react-native-google-fit#readme or can write your own custom logic with "React Native Sensors" – Pramod Aug 17 '23 at 08:59

1 Answers1

1

Yes, you can. With an accelerometer and setting its threshold you may distinguish between walking and stepping up/down stairs (as long as the operator does not apply Tai Chi).

// Get an instance of the SensorManager
    sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    sensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    stepDetector = new StepDetector();
    stepDetector.registerListener(this);

    // Set stored value of sensibility
    int sensibility = sharedPreferences.getInt("stepcounter", 50);
    stepDetector.STEP_THRESHOLD = (float) sensibility;