Vanya Sakharovskiy Vanya Sakharovskiy - 1 year ago 126
Android Question

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){

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
) I got this dialog. Do you know how to fix it?

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

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download