How to check which number is deleted from usercontact which has mutiple contact?

时间:2017-12-18 06:49:14

标签: android android-contacts contactscontract

I have added multiple number under different categories for single user like,enter image description here

If I delete the one of the numbers , I want to detect which number got deleted from contact using ContactsContract content uris

1 个答案:

答案 0 :(得分:1)

ContactsContract API可以告诉您Contacts表(通过ContentObserver)中的某些已更改,但不是确切地说。

如果您想检测发生的更改,您需要保留并维护应用中所有联系人的缓存副本,您不需要实际数据本身,只需要每个数据的哈希值每个联系人的行。

然后,当您调用onChange时,您可以查看数据库中的所有数据行,并将它们与您上次找到的哈希值进行比较,并查看是否添加/修改/删除了任何数据行。 / p>