Oreo BroadcastReceiver SMS Received not working

Previously I was requesting for -Manifest.permission.READ_SMS which didn’t worked then I changed the permissions to – Manifest.permission.RECEIVE_SMS then it started working in oreo and I also specified the receiver in manifest I don’t know whether that helped or not but this made the day for me

   public static void requestPermissionForReadSMS(Fragment fragment) {
    //        if (fragment.shouldShowRequestPermissionRationale(Manifest.permission.READ_SMS)) {
    //            Helpers.showRequestPermissionAlertDialog(fragment, fragment.getString(R.string.read_sms_permission), fragment.getString(R.string.permission_request));

    //        } else {
            fragment.requestPermissions(new String[]{Manifest.permission.RECEIVE_SMS},
                    Constants.READ_SMS_PERMISSION);
   // }

        }

Leave a Comment