Created
July 17, 2016 11:53
-
-
Save Egorand/c96a161e5138baa97a32c515d2a5efa1 to your computer and use it in GitHub Desktop.
android-testing-runtime-permissions-checking-permissions
This file contains hidden or 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
@Override | |
protected void onResume() { | |
super.onResume(); | |
int permissionStatus = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_CONTACTS); | |
if (permissionStatus == PackageManager.PERMISSION_GRANTED) { | |
loadContacts(); | |
} else if (!isPermissionAlreadyDenied) { | |
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_CONTACTS}, | |
REQ_CODE_PERMISSIONS_READ_CONTACTS); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment