Skip to content

Instantly share code, notes, and snippets.

@TheBotBox
Created June 5, 2020 12:35
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 TheBotBox/85faf38f858148dfdb7694b6f4b76c1b to your computer and use it in GitHub Desktop.
Save TheBotBox/85faf38f858148dfdb7694b6f4b76c1b to your computer and use it in GitHub Desktop.
fun AppCompatActivity.hasPermissions(vararg permissions: String): Boolean {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
permissions.all { singlePermission ->
applicationContext.checkSelfPermission(singlePermission) == PackageManager.PERMISSION_GRANTED
}
else true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment