Android requestpermissions does not display a dialog box

I found many similar topics, but they all faced the same threat, but I still couldn't find a solution to my problem. I wrote this code to grant write permission to the application, but there was no dialog box. I entered the monitor and saw the message that I didn't have write permission

if(ContextCompat.checkSelfPermission(getContext(),Manifest.permission.WRITE_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED) {
Log.i("permissions", "No writing permission");

ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 225);

I added permissions to the androidmanifest file

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

The target SDK targetsdkversion 23 has been changed, and I am using Android 6.0.1

Edit: I also bound this code, but it still doesn't work properly

requestPermissions(new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, 225);

resolvent:

The requestpermissions dialog box is displayed on > = 6.0 devices only in the following two cases:

1) You have granted permission for any hazard permit in the category you requested

2) When the dialog box was previously displayed, you clicked the do not ask again check box

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>