How to ask permission, the clean way - Droidcon 2021
Presentation at Droidcon 2021 by Ronaldo Pace
How to ask permission, the clean way
Tells the approach to implement Android Runtime permissions using a "clean" approach of service/repository/viewModel by the means decoupling it from the Android UI.
my previous library "permission-bitte" into a V2 that will be the full implementation on what's on this presentation. This will be a nights and weekends deal, so might take a lil bit to complete. So if you're interested, be sure to watch or star the repo on https://github.com/budius/permission-bitte
Application) : PermissionService { private val activityCallback = object : ActivityLifecycleCallbacks { override fun onActivityResumed(activity: Activity) { val newData = extractPermissionsFromManifest(activity) _permissions.value = updatePermissions(newData, _permissions.value) } } } private fun updatePermissions( newData: Map<String, PermissionState>, current: Map<String, PermissionState> ): Map<String, PermissionState> { // any permissions that current is DENIED, // must stay DENIED // the others, pick from the newData }