getCallPermissionStatus

Gets the current VoIP call permission status.

This method returns the current state of the READ_PHONE_NUMBERS permission required for VoIP calls. The status is synchronized with the system before being returned to ensure accuracy.

Status Values:

  • 0 - Permission not requested yet

  • 1 - Permission granted by user

  • 2 - Permission denied by user

Example:

class MainActivity : AppCompatActivity() {
override fun onResume() {
super.onResume()

// Check permission status on resume
when (PushwooshCallSettings.getCallPermissionStatus()) {
0 -> {
// First time - show explanation and request
showVoIPPermissionExplanation()
PushwooshCallSettings.requestCallPermissions()
}
1 -> {
// Granted - enable VoIP features
enableVoIPCallButton()
Log.d("App", "VoIP calls available")
}
2 -> {
// Denied - show settings prompt
showPermissionDeniedDialog()
disableVoIPCallButton()
}
}
}

private fun showPermissionDeniedDialog() {
AlertDialog.Builder(this)
.setTitle("VoIP Permission Required")
.setMessage("Please enable phone permissions in Settings")
.setPositiveButton("Settings") { _, _ ->
openAppSettings()
}
.show()
}
}

Return

the current permission status: - 0 if permission has not been requested yet - 1 if permission was granted by the user - 2 if permission was denied by the user

See also