androidandroid-6.0-marshmallowruntime-permissions

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.


Solution

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