0

I am create an app which need to grand four permissions: Contact, Phone, Storage. I think it really annoy user and I want to ask them only one dialog. I have try this way, but there are dialog to show confirm for each permission.

How to ask only one rational dialog with button confirm and cancel?

Cœur
  • 37,241
  • 25
  • 195
  • 267
K.Sopheak
  • 22,904
  • 4
  • 33
  • 78

3 Answers3

2

You can't club multiple permissions into one. There will be a separate dialog for each permission that is requested even you are passing permission as an array.

Sanjeet
  • 2,385
  • 1
  • 13
  • 22
  • Yub, thank. I think it cannot be hacked more for now. All I can do is to tell rational message explain user about each permission. – K.Sopheak Oct 26 '16 at 04:11
1

Simple answer is you can not, It is not possible to ask multiple permission in same dialog as of now.

You can request for multiple permission, which will be displayed in single dialog of each.

int PERMISSION_ALL = 1; 
String[] PERMISSIONS = {Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS, Manifest.permission.SEND_SMS, Manifest.permission.ACCESS_FINE_LOCATION};

if(!hasPermissions(this, PERMISSIONS)){
    ActivityCompat.requestPermissions(this, PERMISSIONS, PERMISSION_ALL);
}

This is how it will ask for permission to user.

enter image description here

enter image description here

Refer this and this for more details.

Community
  • 1
  • 1
Ravi
  • 34,851
  • 21
  • 122
  • 183
0

Check the following link:

https://developer.android.com/reference/android/support/v4/app/ActivityCompat.html#requestPermissions(android.app.Activity, java.lang.String[], int)

   void requestPermissions (Activity activity, 
            String[] permissions, 
            int requestCode);

requestPermissions method takes an array in which you can pass multiple permissions. See if it works for you. Otherwise, you can pass it separately only.

Ani
  • 1,041
  • 6
  • 15
  • I knew this solution. But my question is to make a custom message to ask only one time to accept all or not accept in only **one click**. – K.Sopheak Oct 21 '16 at 06:40