Last active
November 23, 2016 20:15
-
-
Save muthuraj57/9942e986371b154589240bd3d371e836 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
PermissionUtil.checkPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE, | |
new PermissionUtil.PermissionAskListener() { | |
@Override | |
public void onNeedPermission() { | |
ActivityCompat.requestPermissions( | |
thisActivity, | |
new String[]{Manifest.permission.READ_CONTACTS}, | |
REQUEST_EXTERNAL_STORAGE | |
); | |
} | |
@Override | |
public void onPermissionPreviouslyDenied() { | |
//show a dialog explaining permission and then request permission | |
} | |
@Override | |
public void onPermissionDisabled() { | |
Toast.makeText(context, "Permission Disabled.", Toast.LENGTH_SHORT).show(); | |
} | |
@Override | |
public void onPermissionGranted() { | |
readContacts(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment