I am working on Contact Sync in Android and I have successfully done with First time Contact Sync.
Here is what I am doing. 1. Fetching all Contacts and Saving each contact in DB with Contact._ID 2. Fetching Names and Phone Numbers and saving in DB.
After that I am sending my contacts data to server so that server can be updated.
Now the problem is how can i check whether my particular contact is updated or not ?
I have implemented Broadcast Receiver so that my app can get intimated about the updation/Addition/Deletion of Contact. But I want to tract particular contact.
I found one solution which is Dirty Flag. It tells us about the contact whether its updated or not, Here is the reference link : http://developer.android.com/reference/android/provider/ContactsContract.RawContacts.html
But I am not able to use this Dirty Flag, Could someone please help me by implementing Dirty Flag.
Thanks in Advance !
You can use http://contacts.google.com to access all the same information from any device with the same Google account added onto it.
The contacts should have the value ContactsContract.RawContacts.VERSION
.
If you save this version on the server (or in a database in your app), you can determine if a contact has changed since it was last sent to the server.
You will get number of contacts updated after a particular time from contact data base using below query.
ContactsContract.Contacts.CONTACT_LAST_UPDATED_TIMESTAMP
,try to compare the last uploaded time to your server with this time .Hope then you will get the list of updated contacts after the successful upload to server.
check this http://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns.html#CONTACT_LAST_UPDATED_TIMESTAMP
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With