-1
 ActivityCompat.requestPermissions(thisActivity,
            new String[]{Manifest.permission.READ_CONTACTS},
            MY_PERMISSIONS_REQUEST_READ_CONTACTS);

I want to add permission one by one. I have 6 permission which require grants. I have seen so many app where more than one permission asks at a time. but i am not able to do it. it ask only for one time. i have added same code 5 times.

1 Answers1

1
 int MY_PERMISSIONS_REQUEST_READ_CONTACTS=0;
        ActivityCompat.requestPermissions(this,
                new String[]{Manifest.permission.READ_CONTACTS,Manifest.permission.ACCESS_COARSE_LOCATION,Manifest.permission.ACCESS_FINE_LOCATION
        ,Manifest.permission.ACCESS_NETWORK_STATE,Manifest.permission.INTERNET,Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.CAMERA,Manifest.permission.CALL_PHONE},
                MY_PERMISSIONS_REQUEST_READ_CONTACTS);
  • 1
    Is this the answer?, seems like the question before your edit? – Petter Friberg Jun 16 '17 at 21:11
  • @PetterFriberg because he realised he can't post a question with the answer in it so he most likely edited the question to be incorrect so that he could answer it(?). I think the idea behind that was to archive the solution for this problem in a way. – Andor Németh Oct 21 '20 at 14:32