Skip to content

Instantly share code, notes, and snippets.

@PatilSiddhesh
Created February 17, 2020 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatilSiddhesh/6e198a2bda2c24caa0813d9ad7dec181 to your computer and use it in GitHub Desktop.
Save PatilSiddhesh/6e198a2bda2c24caa0813d9ad7dec181 to your computer and use it in GitHub Desktop.
/**
* Shows rationale dialog for displaying why the app needs permission
* Only shown if the user has denied the permission request previously
*/
private fun showRationaleDialog(
title: String,
message: String,
permission: String,
requestCode: Int
) {
val builder: AlertDialog.Builder = AlertDialog.Builder(this)
builder.setTitle(title)
.setMessage(message)
.setPositiveButton("Ok", { dialog, which ->
requestPermissions(arrayOf(permission), requestCode)
})
builder.create().show()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment