It is very hard to ensure that someone with write access can't also get data
back from the provider, so generally no.

Alternatively you could use the intent protocol to bring up the contacts
editor with your data to allow the user to be involved with adding it, using
SHOW_OR_ADD_CONTACT:
http://developer.android.com/reference/android/provider/ContactsContract.Intents.html#SHOW_OR_CREATE_CONTACT

<http://developer.android.com/reference/android/provider/ContactsContract.Intents.html#SHOW_OR_CREATE_CONTACT>This
should not require any permissions.

On Sat, Aug 21, 2010 at 4:19 AM, Pinheiro <[email protected]> wrote:

> I'm trying to add a contact inside an app but the only working code
> I've found requires READ_CONTACTS permission. Here's the code:
>
>                ContentValues values = new ContentValues();
>                values.put(Contacts.People.NAME, contactName);
>
>                Uri uri =
> Contacts.People.createPersonInMyContactsGroup(getContentResolver(),values);
>                Uri newContact =
> Uri.withAppendedPath(uri,People.Phones.CONTENT_DIRECTORY);
>                values.clear();
>
> values.put(People.Phones.TYPE,People.Phones.TYPE_WORK);
>                values.put(People.Phones.NUMBER,workPhone);
>                getContentResolver().insert(newContact, values);
>
> Since READ_CONTACTS could freak people out, is there any other way to
> insert a contact that requires only the WRITE_CONTACTS permission?
> Thanks in advance!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to