Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
97 views
in Technique[技术] by (71.8m points)

android - ALLOW button not working after update

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

EDIT: It has been marked as a defect in the last android and it will be fix in a future release of the OS. Bug report

EDIT 2: File manager email me that they fix this feature in their app. I have not try File Manager anymore, but if you update the app it should not give you this problem anymore. But basically this behavior, could be from any app doing overlay in a wrong way until android fix it.

I finally got it (at least in my case)... its the f**** File Manager app's service. If its service is stopped, the permissions work again.

https://play.google.com/store/apps/details?id=com.rhmsoft.fm

I had this app before the update to "MOB30M" and the runtime permissions where working without a problem (is my daily job to program this) and i have been using the file manager to put the release APK inside the phone and run it to install the APK. So is not some app that I installed today.

What I fund awful is that one app can make crash all the permission system.

It's and overly problem

I understand that the permission system is not being crashed, since an app could be used to falsify the dialogs, BUT shouldn’t then Android (Google) tell you that you have an app that is running on the top and that if you want to give permissions to the app you should uninstall XXXX app? I mean for the sake of the User Experience.

A normal user, would think that his phone is broken and probably would send the phone back to google or the carrier xD

Come on, let's be honest, cant android make this better? Is not like you need your phone rooted to have this behavior (my phone is not rooted). If you dont inform the user what's going on, then is like is broken


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...