-
-
Save DUMA042/2ff5a03601f712b597f789968d04bbab to your computer and use it in GitHub Desktop.
This file contains 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
@OptIn(ExperimentalPermissionsApi::class) // Opt-in to use experimental permissions API | |
@Composable | |
fun HomeScreen(modifier: Modifier = Modifier) { | |
// State to hold the scanned barcode value, saved across recompositions | |
var barcode by rememberSaveable { mutableStateOf<String?>("No Code Scanned") } | |
// State to manage the camera permission | |
val permissionState = rememberPermissionState( | |
Manifest.permission.CAMERA // Permission being requested | |
) | |
// State to track whether to show the rationale dialog for the permission | |
var oncancel by remember(permissionState.status.shouldShowRationale) { | |
mutableStateOf(permissionState.status.shouldShowRationale) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment