registerForActivityResult 대신 rememberLauncherForActivityResult 을 활용하여 권한요청을 작성하면 됩니다.

@Preview
@Composable
fun PermissionTestInCompose() {
    val launch = rememberLauncherForActivityResult(
        contract = ActivityResultContracts.RequestPermission(),
        onResult = {

        })

    Button(onClick = {
        launch.launch(
            Manifest.permission.CAMERA
        )
    }) {

    }
}

 

https://github.com/sarang628/ComposePermissionTest

 

GitHub - sarang628/ComposePermissionTest

Contribute to sarang628/ComposePermissionTest development by creating an account on GitHub.

github.com

 

+ Recent posts