Skip to content Skip to sidebar Skip to footer

Package Installer Crashes In Android M After Requesting Permission Read_sms

I have a Login Fragment that tries to access (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); this works well with devices up to Lollipop 5.1. And when

Solution 1:

You've restricted the READ_SMS manifest permission to API 22 and below.

<uses-permissionandroid:name="android.permission.READ_SMS"android:maxSdkVersion="22" />

As I mentioned in the comments, this manifest permission is still needed in Marshmallow and above, in addition to the runtime request. Remove the maxSdkVersion attribute from the permission element.

Solution 2:

Declare permission in manifest like this:

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

Mind it, there is no maxSdkVersion attribute. Reference.

Post a Comment for "Package Installer Crashes In Android M After Requesting Permission Read_sms"