onPermissionResult
abstract fun onPermissionResult(granted: Boolean, grantedPermissions: List<String>, deniedPermissions: List<String>)
Called when the permission request is completed.
This method is invoked on the main thread immediately after the user responds to the system permission dialog. It provides detailed information about which permissions were granted and which were denied.
Example:
override fun onPermissionResult(
granted: Boolean,
grantedPermissions: List<String>,
deniedPermissions: List<String>
) {
if (granted) {
// All permissions granted - VoIP ready
Toast.makeText(this, "VoIP calls enabled", Toast.LENGTH_SHORT).show()
showVoIPCallButton()
} else {
// Some permissions denied
val deniedList = deniedPermissions.joinToString(", ")
Log.w("App", "Denied permissions: $deniedList")
// Show explanation or redirect to settings
AlertDialog.Builder(this)
.setMessage("Phone permission is required for VoIP calls")
.setPositiveButton("Settings") { _, _ -> openSettings() }
.show()
}
}Content copied to clipboard
Parameters
granted
true if all requested permissions were granted by the user, false if any permission was denied.
grantedPermissions
list of permission strings that were granted. Typically contains "android.permission.READ_PHONE_NUMBERS" when VoIP permissions are granted.
deniedPermissions
list of permission strings that were denied by the user. Empty list if all permissions were granted.