Need permission to access contacts to save contact information from app to native contacts?

1.2k Views Asked by At

This question is regarding permission requests.

I want to know whether it's necessary to request permission to access contacts in order to offer the functionality of allowing users to download a contact from an app and save it to their native contacts.

I want to know if it's necessary for the app to make this request to offer this functionality. If so, is this the case for both iOS and Android?

Thanks!

1

There are 1 best solutions below

0
marmor On

For Android only - the short answer is no. you can allow your users to add a new contact without any permission. To do that, call the following intent (here with example of adding the new contact with some phone numner):

Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
intent.putExtra(ContactsContract.Intents.Insert.PHONE, phoneNumber);
startActivity(intent);

You can check all the other types of info you can put on that contact here: https://developer.android.com/reference/android/provider/ContactsContract.Intents.Insert

Note that this method will open the contact-editor screen with that data pre-filled, in which the user can edit the info, and click "save" when done.

If you want the entire experience to be seamless and in the background without any user interaction, you will need the WRITE_CONTACTS permission, and to do that using ContactsContract APIs