Created
July 4, 2018 05:40
-
-
Save shikto1/354288d80600c6829ec3a8ca5375b7cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (ContextCompat.checkSelfPermission(thisActivity,Manifest.permission.READ_CONTACTS)!= PackageManager.PERMISSION_GRANTED) { | |
if (ActivityCompat.shouldShowRequestPermissionRationale(thisActivity, | |
Manifest.permission.READ_CONTACTS)) { | |
// Show an expanation to the user | |
} else { | |
if(isFirstTimeAsking(thisActivity, Manifest.permission.READ_CONTACTS){ | |
firstTimeAsking(thisActivity,Manifest.permission.READ_CONTACTS, false); | |
ActivityCompat.requestPermissions(thisActivity,new String[]{Manifest.permission.CAMERA}, REQUEST_CAMERA); | |
} else { | |
//Permission disable by device policy or user denied permanently. Show proper error message | |
} | |
} | |
} else { | |
//permission granted. do your stuff | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment