As my application uses content from android.provider.ContactsContract.Data
(API > 11) and ContactsContract.Contacts.CONTENT_URI
(API < 11) to populate Contacts
.
I've tried to registerContentObserver()
against these provider. But it calls my ContentObserver
even if I tries to Call a person from device as soon as I put the call. It does trigger my ContentObserver
which is not useful for me as there's no Content Change in Contacts Provider
.
Root Cause:
Seems like LAST_TIME_CONTACTED
or something in ContactsContract.Contacts.CONTENT_URI
do changes when a call has been made from device which legitimate wokes up by ContentObserver
.
Tried:
private class ContactsContentObserver extends ContentObserver {
public ContactsContentObserver() {
super(null);
}
@Override
public void onChange(boolean selfChange) {
super.onChange(selfChange);
Zname.getPreferences().setRefreshContact(true);
}
}
Registered ContentObserver
in OnCreate()
of Activity
ContactsContentObserver contactsContentObserver = new ContactsContentObserver();
getContentResolver().registerContentObserver(ContactsContract.Contacts.CONTENT_URI, false, contactsContentObserver);
Tried with notifyForDescendents
as false
on registerContentObserver
. Still it triggers out ContentObserver
Ques:
How can one register ContentObserver
which triggers if and only if contacts information is under CRUD(Create,Update,Delete) except Last_Time_Contacted
or its descendants?