Code example for SensorManager

Methods: getDefaultSensorregisterListener

0
        setContentView(mView);
    } 
 
    @Override 
    protected void onResume() { 
        mSensorManager.registerListener(this,
                                        mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
                                        SensorManager.SENSOR_DELAY_FASTEST);
 
        // Ideally a game should implement onResume() and onPause() 
        // to take appropriate action when the activity looses focus 
        super.onResume(); 
        mView.resume();
    } 
 
    @Override 
    protected void onPause() { 
        super.onPause(); 
        mView.pause();
        onStop(); 
    }