You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.5 KiB
1.5 KiB
layout | title | subtitle | category | order | date |
---|---|---|---|---|---|
page | Runtime Permissions | Permissions and Manifest setup | docs | 8 | 2018-12-20 20:03:03 |
CameraView
needs two permissions:
android.permission.CAMERA
: required for capturing pictures and videosandroid.permission.RECORD_AUDIO
: required for capturing videos withAudio.ON
(the default)
Declaration
The library manifest file declares the android.permission.CAMERA
permission, but not the audio one.
This means that:
- If you wish to record videos with
Audio.ON
(the default), you should also addandroid.permission.RECORD_AUDIO
to required permissions
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
- If you want your app to be installed only on devices that have a camera, you should add:
<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.
Handling
On Marshmallow+, the user must explicitly approve our permissions. You can
- handle permissions yourself and then call
cameraView.start()
once they are acquired - or call
cameraView.start()
anyway:CameraView
will present a permission request to the user based on whether they are needed or not with the current configuration.
In the second case, you should restart the camera if you have a successful response from onRequestPermissionResults()
.