Do you guys know any best practices about calling ...
# multiplatform
r
Do you guys know any best practices about calling android methods that are annotated with
@RequiresPermission
when developing a Multiplatform SDK? Normally i would say that handling the permissions is an App issue, not an SDK issue, so i would also annotate my own methods with the same
@RequiresPermission
annotation, but they are Android-only, so you can’t annotate common methods.
while creating expect/actual versions of all the methods is possible, it seams a lot of work
e
commonMain
Copy code
@OptionalExpectation
expect annotation class RequiresPermission(
    val value: String,
    val allOf: Array<String>,
    val anyOf: Array<String>,
    val conditional: Boolean,
)
androidMain
Copy code
actual typealias RequiresPermission = androidx.annotation.RequiresPermission
will allow you to use
@RequiresPermission
in common code
r
sucks that the default values for the parameters can not be set without a compiler error, but otherwise quite handy
thx