#TODO
AppQuest Pedometer is the 4. application for the App Quest 2016 Treasure Hunt. The application must be able to count the steps and tell when you have to turn right/left to find the treasure.
AppQuest Repository | AppQuest 2016 |
Application Requirements | http://appquest.hsr.ch/2016/schrittzaehler |
Minimum API Level | API level 23 (Marshmallow) |
Development Environment | Android Studio |
#TODO
#TODO
Formula
sqrt(x^2 + y^2 + z^2)
public class Activity extends Activity implements StepListener {
private SensorManager sensorManager;
private Sensor sensor;
private StepCounter stepCounter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_walk);
stepCounter = new StepCounter(this);
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
sensor = (Sensor) sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
}
@Override
protected void onResume() {
super.onResume();
if (stepCounter != null) {
sensorManager.registerListener(stepCounter, sensor, SensorManager.SENSOR_DELAY_FASTEST);
}
}
@Override
protected void onPause() {
super.onPause();
if (stepCounter != null) {
sensorManager.unregisterListener(stepCounter);
}
}
@Override
public void onStep() {
// Ein Schritt wurde gemacht!
}
AppQuest Logbuch format
{
"task": "Schrittzaehler",
"startStation": 1,
"endStation": 4
}