3

I am working with Android API 25 and need to make permissions requests in the app.

There are a ton of code samples on how to make a request as well as how to show the rationale. This link here shows a simple methodology as do these: Android M Request Multiple permission at a single time , Android M request permission non activity

The problem I am having is I am requesting multiple permissions at once (Location, Write storage access, and Contacts) and the ActivityCompatApi23.shouldShowRequestPermissionRationale source code only takes in a String for a single permission and not an array for multiple permissions. (source: android.support.v4.app.ActivityCompat)

So in my code, I can do this:

     ActivityCompat.requestPermissions(activity, permissionsStringArray, 123);

And try to request multiple at once, but I can't then show the explanation for the ones needed if they return true from:

     ActivityCompat.shouldShowRequestPermissionRationale(activity,
                    currentPerm.getPermissionManifestName()

Does anyone have any recommendations on how I can show a dialog that includes multiple rationales in it as opposed to one at a time?

Community
  • 1
  • 1
  • Just to clarify, you want to show one dialog, with multiple permissions, and an explanation for each? – Mehmet K Feb 02 '17 at 18:51

1 Answers1

0

I recommend this open source.

https://github.com/ParkSangGwon/TedPermission

You can use simply. for example

private void CheckPermission() {

        new TedPermission(this)
                .setPermissionListener(permissionlistener)
                .setDeniedMessage(getString(R.string.str_permission1))
                .setPermissions(Manifest.permission.CAMERA, android.Manifest.permission.READ_PHONE_STATE, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE)
                .check();
    }
Star_Man
  • 1,091
  • 1
  • 13
  • 30
  • This put me on the right track, but I ultimately wrote my own. It looks like the answer is something along the lines of it can't be done for multiple, just send them to settings instead. –  Feb 03 '17 at 17:40