What happens if our application requires a lot of permissions that must be handled through the code? It happens that we have a lot of code handling different permission requests. This means that we have a lot of boilerplate code! Luckily for us, we are using Kotlin. Kotlin will be our tool to make things simpler!
Create a new package called permission. Then create two new Kotlin files as follows:
PermissionCompatActivity and PermissionRequestCallback.
Let's define the permission request callback as follows:
package com.journaler.permission interface PermissionRequestCallback { fun onPermissionGranted(permissions: List<String>) fun onPermissionDenied(permissions: List<String>) }
This will be the callback that will be fired when permissions are resolved. Then, define our permission compat activity...