I have registered a ContentObserver
from service and I get the onchange()
function when there is update in phone like call or contact update. But I want the onchange()
function to be called only when add, update or delete happens. But I don't want when call is incoming or outgoing. So can anybody tell me which URI
I can register in contentObserver
? My code is here
getContentResolver().registerContentObserver(ContactsContract.Contacts.CONTENT_URI, true,new Contact_change());
and Contact_change.java class is like
public class Contact_change extends ContentObserver{
public Contact_service() {
super(null);
}
@Override
public void onChange(boolean selfChange){
Log.i("contact_service","onchange");
Super.onChange(selfChange);
}
@Override
public boolean deliverSelfNotifications() {
return true;
}
}
Edit:
I have one more problem is that after stop the service if I made change in contact then also onchange()
function is called. So how can I stop that or un register the contentobserver
.