I don't find anything in Compose docs regarding ho...
# compose
m
I don't find anything in Compose docs regarding how to request Android permissions? ...
d
i
m
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
ha, yeah that'll do it
❤️ 1