https://kotlinlang.org logo
#moko
Title
# moko
j

jamshedalamqaderi

09/18/2023, 11:29 AM
I'm trying moko media from example in my existing project and i have added read external storage permission in the manifest file but i'm still getting this error while it is same as example. What could be go wrong?
error dev.icerock.moko.permissions.DeniedAlwaysException
this is my test implementation Compose:
1.5.1
Kotlin:
1.9.10
Java Toolchain:
17
targetSdk:
34
compileSdk:
34
Copy code
@Composable
fun Media() {
    val factory = rememberMediaPickerControllerFactory()
    val picker = remember(factory) { factory.createMediaPickerController() }
    val coroutineScope = rememberCoroutineScope()

    BindMediaPickerEffect(picker)

    var image: ImageBitmap? by remember { mutableStateOf(null) }
    Column {
        Button(
            onClick = {
                coroutineScope.launch {
                    val result = picker.pickImage(MediaSource.GALLERY)
                    image = result.toImageBitmap()
                }
            }
        ) {
            Text(text = "Click on me")
        }
        if (image != null) {
            Image(bitmap = image!!, contentDescription = null)
        }
    }
}
8 Views