Save in Contacts works in Android 10 but not in Android 11

639 views Asked by At

Am facing some weird issue I have an android app that allows users to save the profile details in Contacts like Name, phone, email, this functionality is working in Android 10 but not in Android 11. In Android 11 am able to see the contacts saved in the Phone App contacts page but this not reflecting in Contacts App. Are there any extra permissions or settings we need in Android 11 to get this work?

enter image description here

Contact Saved in phone app contacts page

enter image description here

But not reflecting in the Contacts App

2

There are 2 answers

1
Joey van Hummel On

In Android 11, the READ_PHONE_NUMBERS permission replaces the READ_PHONE_STATE permission for reading contact info.

See also: Permission updates in Android 11

1
maulik panchal On

Android 11 changes the phone-related permission that your app uses when reading phone numbers.

If your app targets Android 11 or higher and needs to access the phone number APIs shown in the following list, you must request the READ_PHONE_NUMBERS permission, instead of the READ_PHONE_STATE permission.

The getLine1Number() method in both the TelephonyManager class and the TelecomManager class. The unsupported getMsisdn() method in the TelephonyManager class. If your app declares READ_PHONE_STATE to call methods other than the ones in the previous list, you can continue to request READ_PHONE_STATE across all Android versions. If you use the READ_PHONE_STATE permission only for the methods in the previous list, however, update your manifest file as follows:

Change your declaration of READ_PHONE_STATE so that your app uses the permission only on Android 10 (API level 29) and lower. Add the READ_PHONE_NUMBERS permission.