Here are two ways to introduce, as follows:
1. One by one
private static final int PERMISSION_READ_EXTERNAL_STORAGE = 101; private static final int PERMISSION_WRITE_EXTERNAL_STORAGE = 102; private static final int PERMISSION_CAMERA = 103; private void requestPermission() { if ((this, .WRITE_EXTERNAL_STORAGE)== PackageManager.PERMISSION_DENIED) { (this, new String[]{.WRITE_EXTERNAL_STORAGE}, PERMISSION_WRITE_EXTERNAL_STORAGE); } if ((this, .READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) { (this, new String[]{.READ_EXTERNAL_STORAGE}, PERMISSION_READ_EXTERNAL_STORAGE); } if ((this, ) == PackageManager.PERMISSION_DENIED) { (this, new String[]{}, PERMISSION_CAMERA); } } @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int []grantResults) { switch (requestCode) { case PERMISSION_CAMERA: { if ( > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { } else { (this, "I can't do anything without camera permission!", Toast.LENGTH_LONG).show(); } break; } case PERMISSION_READ_EXTERNAL_STORAGE: { if ( > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { } else { (this, "Please turn on storage read and write permissions to ensure that the APP is running normally", Toast.LENGTH_LONG).show();; } break; } case PERMISSION_WRITE_EXTERNAL_STORAGE: { if ( > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { } else { (this, "Please turn on storage read and write permissions to ensure that the APP is running normally", Toast.LENGTH_LONG).show();; } break; } } }
2. All
private void requestPermission() { List<String> permissionsNeeded = new ArrayList<String>(); if ((this, .WRITE_EXTERNAL_STORAGE)== PackageManager.PERMISSION_DENIED) { (.WRITE_EXTERNAL_STORAGE); } if ((this, .READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) { (.READ_EXTERNAL_STORAGE); } if ((this, ) == PackageManager.PERMISSION_DENIED) { (); } if(()>0){ (this, (new String[()]), 1); } } @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int []grantResults) { switch (requestCode) { case 1: { if ( > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { if ( > 0 && grantResults[1] == PackageManager.PERMISSION_GRANTED) { if ( > 0 && grantResults[2] == PackageManager.PERMISSION_GRANTED) { } else { dialog(); } } else { dialog(); } } else { dialog(); } break; } } }
The above android 6.0 permission authorization method is all the content I share with you. I hope you can give you a reference and I hope you can support me more.