Skip to content

Instantly share code, notes, and snippets.

Last active September 2, 2016 22:30
What would you like to do?
private void requestMultiplePermissions() {
String locationPermission = Manifest.permission.ACCESS_FINE_LOCATION;
String calendarPermission = Manifest.permission.WRITE_CALENDAR;
int hasLocPermission = checkSelfPermission(locationPermission);
int hasCalPermission = checkSelfPermission(calendarPermission);
List<String> permissions = new ArrayList<String>();
if (hasLocPermission != PackageManager.PERMISSION_GRANTED) {
if (hasCalPermission != PackageManager.PERMISSION_GRANTED) {
if (!permissions.isEmpty()) {
String[] params = permissions.toArray(new String[permissions.size()]);
requestPermissions(params, REQUEST_PERMISSIONS);
} else {
// We already have permission, so handle as normal
Copy link

Do you have the full code somewhere on github? I trying to figure out how to invoke this method and also implmentations of checkSelfPermission and requestPermissions

Copy link

esmeel commented Sep 2, 2016

  1. in this case, do I need to override onRequestPermissionsResult() ??
    and what will I check there? (all the permissions requested)?
  2. I try it(the code above) I just get one dialogue, thus one request!! when allow I wait for another and not get it..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment