Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android 6.0 Permissions. Read SMS

I want to get the permission to read SMS in my App. This is my code:

String permission = Manifest.permission.READ_SMS;
if (ContextCompat.checkSelfPermission(getContext(), permission) != PackageManager.PERMISSION_GRANTED){
    permissionList.add(permission);

    if (!ActivityCompat.shouldShowRequestPermissionRationale(getActivity(), permission)){
        requestPermissions(new String[]{permission}), SMS_PERMISSION);
    }
}

I didn't get dialog to confirm the permission request. For other permissions (like WRITE_STORAGE, READ_CONTACTS) I got this dialog. Do you know how to fix it?

Method onRequestPermissionsResult gives to me that permission isn't granted. But it works, without the confirmation dialog.

like image 812
Vanya Sakharovskiy Avatar asked Oct 31 '22 11:10

Vanya Sakharovskiy


1 Answers

I need the <uses-permission-sdk-23/> for confirm dialog.

like image 59
Vanya Sakharovskiy Avatar answered Nov 11 '22 11:11

Vanya Sakharovskiy