Skip to content

Instantly share code, notes, and snippets.

@felipebelluco
Created September 28, 2018 15:04
Show Gist options
  • Save felipebelluco/c754fe1c2aa491a5e6b0d62c989f43bd to your computer and use it in GitHub Desktop.
Save felipebelluco/c754fe1c2aa491a5e6b0d62c989f43bd to your computer and use it in GitHub Desktop.
if (ContextCompat.checkSelfPermission(this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
// Verifica se o usuário já negou acesso a permisão
if (shouldShowRequestPermissionRationale(Manifest.permission.CALL_PHONE)) {
// Usuário negou acesso
// Mostrar uma dialog explicando a importância do app ter acesso a funcionalidade
} else {
// Usuário não negou acesso ou negou e marcou a caixa de "não perguntar novamente"
// Fazer a requisição da permissão
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment