Created
July 27, 2020 02:55
-
-
Save cdmunoz/5b6a515a06d25f96dc4512bb008c7284 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val cameraPermission = | |
registerForActivityResult(ActivityResultContracts.RequestPermission()) { granted -> | |
with(binding.root) { | |
when { | |
granted -> snackBar("Permission granted!") | |
shouldShowRequestPermissionRationale(Manifest.permission.CAMERA) -> { | |
//this option is available starting in API 23 | |
snackBar("Permission denied, show more info!") | |
} | |
else -> snackBar("Permission denied") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment