I want to know how I can use accelerometer sensor to determine distance that I an walk it at Android device If it is possible, then how can I implement it?
I use this code but not run. Any answer please??
@Override
public void onSensorChanged(SensorEvent event) {
float[] values = event.values;
int value = -1;
if (values.length > 0) {
value = (int) values[0];
}
if(event.sensor.getType()==Sensor.TYPE_STEP_DETECTOR) {
steps++;
}
}
float distance = (float)(steps*68.475)/(float)100000;