Попробуйте это
String[] permissionsRequired = new String{Manifest.permission.CAMERA,
Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.RECORD_AUDIO};
//on button click
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", getPackageName(), null);
intent.setData(uri);
startActivityForResult(intent, REQUEST_PERMISSION_SETTING);
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
switch (requestCode) {
case PERMISSION_REQUEST_CODE:
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(getApplicationContext(), "Permission Granted", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "Permission Denied", Toast.LENGTH_SHORT).show();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if ((ContextCompat.checkSelfPermission(this, permissionsRequired[0])
!= PackageManager.PERMISSION_GRANTED) ||
(ContextCompat.checkSelfPermission(this, permissionsRequired[1])
!= PackageManager.PERMISSION_GRANTED) ||
(ContextCompat.checkSelfPermission(this, permissionsRequired[2])
!= PackageManager.PERMISSION_GRANTED)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermission();
}
}
}
}
break;
}
}
public void requestPermission() {
ActivityCompat.requestPermissions((Activity) this, permissionsRequired, REQUEST_PERMISSION_SETTING);
}