I want to read Contacts via Contacts Picker
like this:
Intent contactPickerIntent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
startActivityForResult(contact, CONTACT_PICK_CODE);
If I get the Result, the intent.getData()
contains an uri
to lookup the Contact, but I need the permission READ_CONTACTS
to to read it.
I thought it may be possible to recieve a Contact without this permission, similar to the CALL
permission: If I want to make a call directly, I need it, but without it I can send a number to the phone app, and the user must click on the call button.
Is there a similar functionallity for READ_CONTACTS
I'm not aware of?
I hope there isn't such a functionality. The way you compare the "call without permissions" with the "read contacts without permissions" will be i think like the user has to enter the contactdata per hand.
The permissions have to be requested by app to protect the privacy of the user and helps to prevent data-collecting-apps.
If your app needs the contact list I think you can add the permission and the user will understand why you need it. If you don't need the contacts, you should not try the read the contacts.
An app always should only provide functionality that is really needed and nothing more. If a desktop-programm will collect data of what you are doing on computer, what games you are playing, whit whom you are mailing, etc. you will call it a trojan.
So just read the contacts if its really needed and then the user will give you the permissions therefore.
The permission.system of android mostly make sense ;)
You can retrieve Contact info without permissions and is something like you tell in the question.
In resume, you create an intent to pick a contact, this give you a URI (and temporally, also give you permissions to read it), then you use the URI to query to retrieve the data using Contact Provider API.
You can read more about it in Intents guide.
For example (from the guide):