Code example for Sensor

Methods: getType

0
	 */ 
	@Override 
	public void onSensorChanged(final SensorEvent event) {
		if (logging) {
			final Sensor sensor = event.sensor;
			final int type = sensor.getType();
			switch (type) {
			case Sensor.TYPE_MAGNETIC_FIELD:
				magfield = event.values.clone();
				magfieldUpdated = true;
				break; 
			case Sensor.TYPE_TEMPERATURE:
				temperature = event.values[0];
				break; 
			case Sensor.TYPE_ACCELEROMETER:
				if (calculateOrientation && magfieldUpdated) {
					magfieldUpdated = false;
					final int matrix_size = 16;
					final float[] R = new float[matrix_size];
					final float[] I = new float[matrix_size];
					final float[] outR = new float[matrix_size];