Skip to content

Instantly share code, notes, and snippets.

@felipebelluco
Last active September 28, 2018 17:26
Show Gist options
  • Save felipebelluco/cc61037e80ce79498a26fcad80cc7090 to your computer and use it in GitHub Desktop.
Save felipebelluco/cc61037e80ce79498a26fcad80cc7090 to your computer and use it in GitHub Desktop.
AlertDialog.Builder(thisActivity).apply {
setMessage(R.string.never_ask_again_message)
setTitle(R.string.never_ask_again_title)
setPositiveButton(R.string.go_to_settings) { d, i ->
// Cria intent para a tela de detalhes do app onde é possível o usuário conceder permissão à funcionalidade
val appSettings = Intent().apply {
action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS
data = Uri.fromParts("package", thisActivity.packageName, null)
}
startActivity(appSettings)
}
setNegativeButton(R.string.no) { d, i -> d.dismiss() }
}.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment