Code example for SensorManager

Methods: getDefaultSensorregisterListener

0
 
	@Override 
	protected void onResume() { 
		super.onResume(); 
 
		sensorManager.registerListener(this,
		    sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
		    SensorManager.SENSOR_DELAY_FASTEST);
 
		mCamera = Camera.open();
		cameraCurrentlyLocked = defaultCameraId;
		mPreview.setCamera(mCamera);
	} 
 
	@Override 
	protected void onPause() { 
		super.onPause(); 
		sensorManager.unregisterListener(this);
 
		if (mCamera != null) {
Experience pair programming with AI  Get Codota for Java