CameraView needs two permissions:
android.permission.CAMERA : required for capturing pictures and videosandroid.permission.RECORD_AUDIO : required for capturing videos with Audio.ON (the default)The library manifest file declares the android.permission.CAMERA permission, but not the audio one. This means that:
Audio.ON (the default), you should also add android.permission.RECORD_AUDIO to required permissions<uses-permission android:name="android.permission.RECORD_AUDIO"/> <uses-feature android:name="android.hardware.camera" android:required="true"/> If you don’t request this feature, you can use CameraUtils.hasCameras() to detect if current device has cameras, and then start the camera view.
On Marshmallow+, the user must explicitly approve our permissions. You can either:
open() or setLifecycleOwner() once they are acquiredCameraView request permissions: we will present a permission request to the user based on whether they are needed or not with the current configuration.The automatic request is currently done at the activity level, so the permission request callback onRequestPermissionResults() will be invoked on the parent activity, not the fragment.
The automatic request can be disabled by setting app:cameraRequestPermissions="false" in your XML declaration or by using this method setRequestPermissions(boolean requestPermissions) in your code.