Skip to content

Instantly share code, notes, and snippets.

@Kashif-E
Created March 6, 2021 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kashif-E/08aac83661a711b688a91b7743758f2d to your computer and use it in GitHub Desktop.
Save Kashif-E/08aac83661a711b688a91b7743758f2d to your computer and use it in GitHub Desktop.
private fun checkPermissions() {
if (allPermissionsGranted()) {
startCamera()
} else {
cameraPermission.launch(Manifest.permission.CAMERA)
}
}
private fun allPermissionsGranted() = REQUIRED_PERMISSIONS.all {
ContextCompat.checkSelfPermission(
requireContext(), it
) == PackageManager.PERMISSION_GRANTED
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment