Does Anko offer a special mechanism to deal with r...
# anko
c
Does Anko offer a special mechanism to deal with requesting permissions at runtime? Implementing it the "regular way", as it would be done in pure Java, seems pretty clunky and un-Kotlin to me.
m
I use this to fix ugly Android APIs like runtime permissions, starting activities for result, and more. https://github.com/Miha-x64/Flawless
c
Thank you! I'll have a look at that.
a
Here is another solution that I built: https://github.com/AllanWang/KAU/tree/dev/core/src/main/kotlin/ca/allanwang/kau/permissions Example call: https://github.com/AllanWang/KAU/blob/dev/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt#L36 If you want to implement it yourself, the idea is that you can pass a vararg of permission keys and register a callback. You can keep a weak reference to it and then handle the callbacks when you get a response. The problem here is that your permission requests will not stick if your activity reloads (which is why the response is tied to the activity anyways), but that is typically fine as the user can just request it again