Permission Handling in Compose Multiplatform - KMP for Beginners

preview_player
Показать описание
In this video you'll learn how we can use Moko Permissions to handle permissions across Android and iOS.

💻 Let me be your mentor and become an industry-ready Android developer in 10 weeks:

⭐ Courses with real-life practices
⭐ Save countless hours of time
⭐ 100% money back guarantee for 30 days
⭐ Become a professional Android developer now:

Get my FREE PDF about 20 things you should never do in Jetpack Compose:

Join my Discord server:

Get the source code for this video on GitHub:
Рекомендации по теме
Комментарии
Автор

you are the only reason i am learning kotlin instead of flutter

yashinshekh
Автор

Thank you! Will you create video with firebase crashlytics and may be firebase push notification? Camera functionality is also interesting :)

roshkaalex
Автор

Thank you! A topic which I'd love to see as well, would be KMP with a multi-module app structure :)
Would be super helpful, seeing this explained by you

timdavidfriedrich
Автор

Great video Philipppp! Should be great to find how to solve to manage multilang iOS param string from the kmp project instead xcode hardcoding :)

santyas
Автор

In this example we create a controller object in a composable and then pass it to the viewmodel, whose lifecycle is longer living that the activity one. In a pure Android application that is a bad practice, since a configuration change can lead to problems. Am I missing something? Maybe in KMP the rules in this scenario are different than in pure Android?

webbiagio
Автор

Greetings from Brazil. Do you really think KMP is the future? I am speciallizing on it, very disciplined, programing everyday, but struggling to find remote jobs as I live in a small city. Should I keep trying?

UniverseZ
Автор

This is my way of handling the permission with the same library.

Inside the composable screen where you want to ask permission

val permissionHandler = rememberPermissionHandler()

{
PermissionState.Granted -> {}
PermissionState.DeniedAlways -> {
PermissionDeniedDialog(
onDismissRequest = {

},
onConfirmation = {

}
)
}
else -> {

}
}



@Composable
fun rememberPermissionHandler(): PermissionHandler {
val scope = rememberCoroutineScope()
val factory =
val controller = remember(factory) {

}

BindEffect(controller)

return remember(controller) {
PermissionHandler(
controller,
scope
)
}
}

@Stable
class PermissionHandler(
private val _controller: PermissionsController,
private val _scope: CoroutineScope,
) {
var permissionState by

init {
_scope.launch {
permissionState =
}
}

fun openAppSetting() {
_scope.launch {
_controller.openAppSettings()
}
}

fun requestPermission() {
_scope.launch {
try {

permissionState = PermissionState.Granted

} catch (e: DeniedAlwaysException) {
permissionState = PermissionState.DeniedAlways

} catch (e: DeniedException) {
permissionState = PermissionState.Denied

} catch (e: RequestCanceledException) {
e.printStackTrace()
}
}
}
}

lokiksoni
Автор

How can we take multiple permission on single click: like for Location and Storage?

mahaks-ux
Автор

The button don't get hidden when we back from setting to the app we have to relaunch the app to update state.

lokiksoni
Автор

Can this be implemented using DI koin?

GoopleDev-ou
Автор

Is it necessary for app to be relaunched on IOS for it to get permission acceptance changes?

Chirag-Redij
Автор

Hi dude, I wanted to know which operating system is the best to use linux or windows? and after KMP, you write app for ios using swift or objective-c or you only Android dev?

mollyolly
Автор

Dispointed when got to know No ConstraintLayout in CMP.

swapniljadhav
Автор

Thank You, I Think it`s Time To Local Database And Show Notifications so all the basics is covered 🫶

abdelrahmankhaled