Thread
#compose
    Mehdi Haghgoo

    Mehdi Haghgoo

    11 months ago
    I don't find anything in Compose docs regarding how to request Android permissions? ...
    Damian Zawadzki

    Damian Zawadzki

    11 months ago
    i

    Ian Lake

    11 months ago
    Mehdi Haghgoo

    Mehdi Haghgoo

    11 months ago
    Yes, it's there in the documentation. Thanks
    Strangely, though, the following code does not work:
    val recordAudioPerm = rememberPermissionState(android.Manifest.permission.RECORD_AUDIO)
    Button(onClick={
    if (! recordAudioPerm.hasPermission) {recordAudioPerm.launchPermissionRequest()}
    }
    ){
    Text("Record")
    }
    I mean, the permission prompt is never shown, and debugging shows that the value of recordAudioPerm is true!
    Turns out I was running the code on an Android 5.0 device!
    Runtime permissions work only with Android M+.
    i

    Ian Lake

    11 months ago
    ha, yeah that'll do it