The source code (which is now available) is your best friend when it
comes to finding answers to these kinds of questions.  It really
shouldn't be neccessary to ever having to look at source code, but
it's the reality that the documentation is sometimes not detailed
enough.

On Nov 23, 2:42 am, Satya Komatineni <satya.komatin...@gmail.com>
wrote:
> The immediate problem seem to be "my over caution" that made me put
>
>  cv.put(Data.IS_USER_PROFILE, "1");
>
> My reasoning was that this will be used to distinguish whether to add
> the data element to the profile raw contact or the plain raw contact.
>
> That paranoia seem to be unfounded.
>
> when I remove this the code worked fine even with the same
> Data.CONTENT_URI with out the need for Data.PROFILE_CONTENT_URI.
>
> The code underneath seem to know this difference by merely looking at
> the raw contact id passed in. There must be some logic the code is
> using to see where this raw contact id is from.
>
> Anyways temporarily I understand a little m ore.
>
> (Ali, thanks for the link as well)
>
> On Mon, Nov 21, 2011 at 3:48 PM, Satya Komatineni
>
>
>
>
>
> <satya.komatin...@gmail.com> wrote:
> > I see that there is a URI for inserting/contributing a raw contact to
> > the new (4.0) personal profile
>
> > ContactsContract.Profile.CONTENT_RAW_CONTACTS_URI
>
> > I am able to use this URI to insert a raw contact (with a specific
> > account type and name) into the personal profile.
>
> > However I don't see a corresponding URI for the Data contract such as
>
> > ContactsContract.Data.PROFILE_CONTENT_URI
>
> > How do one go about addint a data element to a raw contact that
> > contributes to a profile?
>
> > For example I ran the following code
>
> > private void insertPhoneNumber(long rawContactId)
> > {
> >  ContentValues cv = new ContentValues();
> >  cv.put(Data.RAW_CONTACT_ID, rawContactId);
> >  cv.put(Data.IS_USER_PROFILE, "1");
> >  cv.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);
> >  cv.put(Phone.NUMBER,"P123 123 " + rawContactId);
> >  cv.put(Phone.TYPE,Phone.TYPE_HOME);
> >  this.mContext.getContentResolver().insert(Data.CONTENT_URI, cv);
> >  if (puri == null) {
> >      log("Not able to insert phone number");
> >  }
> >  else {
> >      log("Not able to insert phone number");
> >  }
> > }
>
> > This returns a NULL phone uri indicating that the operation failed.
>
> > I am not able to get a clear picture from the documentation. I see
> > that there are two databases: one for the regular contacts
> > (contacts.db) and one for the profile contacts (profile.db). I also
> > see that the raw contacts for profile and the regular contacts are
> > kept separately.
>
> > However I am not able to insert a data value for a personal profile
> > raw contact.
>
> > Appreciate if someone can clarify
>
> > Thanks
> > Satya
>
> --
> Satya Komatinenihttp://www.satyakomatineni.comhttp://www.androidbook.com- 
> Hide quoted text -
>
> - Show quoted text -

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

Reply via email to