On the devices which have installed the latest update of Android Marshmallow - that is June2016 update, when I ask for permissions, the ALLOW button is not working.
I have tested with these 2 devices:
Nexus 6p (Andoid version - 6.0.1, Build number - MTC19V)
Nexus 7 (Android version 6.0.1, Build number - MOB30M)
Both have the latest update, and when I request permissions, the dialog is shown, but I'm not able to press the ALLOW button.
Here is the code, that I use to request permissions:
public void showPermissionsDialog() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
int hasWriteExternalStoragePermission = activity.checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
int hasWriteGetAccountsPermission = activity.checkSelfPermission(android.Manifest.permission.GET_ACCOUNTS);
if (hasWriteExternalStoragePermission != PackageManager.PERMISSION_GRANTED || hasWriteGetAccountsPermission != PackageManager.PERMISSION_GRANTED) {
activity.requestPermissions(new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE, android.Manifest.permission.GET_ACCOUNTS}, MainActivity.REQUEST_CODE_ASK_PERMISSIONS);
} else {
isAllPermissionsGranted = true;
}
} else {
isAllPermissionsGranted = true;
}
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
if (requestCode == REQUEST_CODE_ASK_PERMISSIONS) {
if (grantResults.length > 0) {
boolean isAllPermissionsGranted = true;
for (int i = 0; i < grantResults.length; i++) {
if (grantResults[i] != PackageManager.PERMISSION_GRANTED) {
isAllPermissionsGranted = false;
}
}
if (isAllPermissionsGranted) {
this.isAllPermissionsGranted = true;
} else {
android.widget.Toast.makeText(this, "Please, grand permissions", android.widget.Toast.LENGTH_LONG).show();
showPermissionsDialog();
}
}
}
}
Any suggestions on how to fix this? Thanks in advance!
EDIT
Here is the bug report to Google. We're still waiting for the fix from Google.
EDIT 1
This issue has been fixed!
question from:
https://stackoverflow.com/questions/37829165/allow-button-not-working-after-update 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…