The issue is more that number information isn't stored in
Contacts.People. Its stored in Contacts.People.Phones.

It will help to think of the Contacts in terms a relational database
(I don't know actually how they are stored, but I believe they're in a
relational database). If you had a database storing contacts you'd
have one People table that stored information about a Person like
name, picture, title, etc. Since people often have more than one phone
number now, you'd have another Phones table with multiple rows for
that person's phone number data and these rows link back to the Person
entity in the People table.

So, the bottom line is a query to the People content provider will
only provide you Person information. You'll need to do another query
to the Phones content provider to get phone numbers and such.

Cheers,
Justin
Android Team @ Google

On May 7, 1:12 am, scimitar <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I want to react to a change in the phone book by transmitting the
> whole contact list to a webservice. For this I use aContentObserver:
>
> ContentResolver cr = getContentResolver();
>  ContactPplContentObserver      pplObserver = new
> ContactPplContentObserver( handler );
>  cr.registerContentObserver(People.CONTENT_URI, true,
>                                                         pplObserver );
>
> where ContactPplContentObserver extends theContentObserverclass:
>
> class ContactPplContentObserver extendsContentObserver{
>         public ContactPplContentObserver(Handler h) {
>                 super(h);
>         }
>
>         public void onChange(boolean selfChange) {
>
>                 c.requery();     //c is a cursor on the Contacts.People
>                 String xml = getXMLMessage(c);
>                 uploadAllContacts(xml);
>         }
>     }
>
> The problem is that whenever I add/edit a new contact, only the 'name'
> field of the contact list gets transmitted to theContentObserver, but
> the 'number' field stays the same (hence null if a new contact is
> added). It seems that it is failing to record the added/edited number.
> Why might this be? Do I need to register the cursor  instead of the
> People Uri?
>
> thanks,
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to