/appquest-pedometer

Android AppQuest Pedometer application for the App Quest 2016.

Primary LanguageJavaMIT LicenseMIT

AppQuest Treasure Map

HSR

About

#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.

General

AppQuest Repository AppQuest 2016
Application Requirements http://appquest.hsr.ch/2016/schrittzaehler
Minimum API Level API level 23 (Marshmallow)
Development Environment Android Studio

Example

#TODO

AppQuest Pedometer

Links

Given code snippets

#TODO

Formula

sqrt(x^2 + y^2 + z^2)

Download classes

stepcounter.java

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
}

License

MIT License