Code example for SensorManager

Methods: unregisterListener

0
        sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), SensorManager.SENSOR_DELAY_NORMAL);
    } 
 
    @Override 
    protected void onLastObserver() { 
        sensorManager.unregisterListener(this);
    } 
 
    @Override 
    public void onAccuracyChanged(final Sensor sensor, int accuracy) {
        /* 
         * There is a bug in Android, which apparently causes this method to be called every 
         * time the sensor _value_ changed, even if the _accuracy_ did not change. So logging 
         * this event leads to the log being flooded with multiple entries _per second_, 
         * which I experienced when running cgeo in a building (with GPS and network being 
         * unreliable). 
         *  
         * See for example https://code.google.com/p/android/issues/detail?id=14792 
         */ 
 
        //Log.i(Settings.tag, "Compass' accuracy is low (" + accuracy + ")");