ContentObserver for listening contact changes
Asked Answered
C

1

10

I really don't understand why content observer listens the changes which is not related with the contact info.

I simply registered to the URI which I wanna listen the changes:

getContentResolver().registerContentObserver(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, true, contactsObserver);

But after calling someone or texting to someone, it triggers and calls onChange method in ContentObserver. So I need to re-sync all the contact list with my application although I don't need to do.

Only field I am interested in:

  • ContactsContract.CommonDataKinds.Phone.CONTACT_ID
  • ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME
  • ContactsContract.CommonDataKinds.Phone.NUMBER

What kind of changes should I implement to listen the changes for this DB items?

Counterfeit answered 5/2, 2013 at 12:23 Comment(3)
got any solution to it,if yes please guide me..i am having the same problem since last 1 weekSantiagosantillan
@user3475052 a recent answer may interest you.Georama
Still facing with this issue.Messiaen
R
0

The Contacts database has a field ContactsContract.Contacts.TIMES_CONTACTED This field is updated every time you contact someone in your contact list.

It is even possible to update this field using your own app, which means, if you contact any contact using an app that updates this field, your onChange() method will be called.

Rebarbative answered 26/1, 2017 at 8:53 Comment(2)
There are more fields like this one, ContactsContract.ContactOptionsColumns.LAST_TIME_CONTACTED for example.Rebarbative
this is a very old question, not sure if OP is still waiting, but maybe @user3475052 will be interested ?Georama

© 2022 - 2024 — McMap. All rights reserved.