Last time the contact was modified

霸气de小男生 提交于 2019-12-09 01:00:29

问题


is there a way to find out the last time a contact was modified? I can't seem to find a variable for it. The reason I'm asking is because I'd like to do a sync of the contacts to my web server and I don't feel like checking for each contact with a HTTP request if it needs updating.

So I was thinking to check the date of the last update to the date of the last sync.


回答1:


Didn't find a way to do this. I can store the last sync date, but no way of checking if the contact was updated since then.

EDIT:

the contact has a DIRTY flag, which is set to 1 if the contact was changed and not synced.




回答2:


I know its an old post, maybe help others... There is a property calked CONTACT_LAST_UPDATED_TIMESTAMP that you can use: https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns.html

Timestamp (milliseconds since epoch) of when this contact was last updated. This includes updates to all data associated with this contact including raw contacts. Any modification (including deletes and inserts) of underlying contact data are also reflected in this timestamp.

Constant Value: "contact_last_updated_timestamp"




回答3:


Depending on your needs, you might also be able to cache ContactsContract.Contacts.Entity.VERSION yourself (for the different raw contacts which are associated with a contact) and compare it to the current values in the Android's content provider.



来源:https://stackoverflow.com/questions/3005932/last-time-the-contact-was-modified

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!