Skip to content

Instantly share code, notes, and snippets.

@magdamiu

magdamiu/CameraXSample.kt

Last active Aug 8, 2020
Embed
What would you like to do?
Smile, it’s CameraX! [preview and capture] | Preview - step 2: permission handling
// manifest
<uses-feature android:name="android.hardware.camera.any" />
<uses-permission android:name="android.permission.CAMERA" />
// fragment or activity
if (areAllPermissionsGranted()) {
startCamera()
} else {
ActivityCompat.requestPermissions(
this, PERMISSIONS, CAMERA_REQUEST_PERMISSION_CODE)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.