Content watcher is called even if contacts are not changed

I ran into a problem that is strange, I use ContentObserver to catch changes in contacts, but the problem is that the onchange() method is called even if I do not make any changes. Here is my code:

 getContentResolver().registerContentObserver(ContactsContract.Contacts.CONTENT_URI, true, new MyCOntentObserver()); public class MyCOntentObserver extends ContentObserver{ public MyCOntentObserver() { super(null); } @Override public void onChange(boolean selfChange) { super.onChange(selfChange); Log.e("","~~~~~~"+selfChange); } @Override public boolean deliverSelfNotifications() { Log.e("","~~~~~~ Change"); return true; } } 

can anyone help?
thanks in advance

+3
source share
1 answer

The registerContentObserver method accepts the boolean notifyForDescendents variable, which you set to true. Maybe set this to false?

Otherwise, maybe some background task is messing with your observer. :)

0
source

All Articles