Skip to content

Instantly share code, notes, and snippets.

@muthuraj57
Last active November 23, 2016 20:15
Show Gist options
  • Save muthuraj57/9942e986371b154589240bd3d371e836 to your computer and use it in GitHub Desktop.
Save muthuraj57/9942e986371b154589240bd3d371e836 to your computer and use it in GitHub Desktop.
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