-2

I am creating an app to backup contacts to a webserver. I am still new to android development so I can't think of the logic to do this. I know that the contact id is not constant and it can change. So how can I keep track of changed data to existing and new contacts?

Eirabie
  • 1
  • 1

1 Answers1

0

You need to first grab the contacts in Android look at the example code in the AOSP project for the people app, that will show you the way that Google is doing it officially, which doesn't necessarily make it the best method, but it's a lot easier to re-tool their code than write it all from scratch.

Here's how to get started with the Android build environment: http://source.android.com/source/initializing.html

Here's another question, similar to yours that might help with the contact data: How to read contacts on Android 2.0

On your end, you need to setup a SQL server of some kind... and one of the fields just needs to be "Last Updated", either add a date to that field, or a revision number that you're tracking elsewhere and decide to update based on the query out of that field.

Community
  • 1
  • 1
RyanInBinary
  • 1,533
  • 3
  • 19
  • 47
  • I already know how to access contact data, what I am looking for is for the code logic on how to keep it in sync with the webserver. Does android provide last updated info with the contact data? – Eirabie Aug 07 '12 at 16:59
  • In that case check the sync services code, but since it displays a 'last sync' textview in the settings > accounts UI, that information is definitely stored somewhere. Looking through the AOSP code should help you to locate it. It might even be faster to look directly at the code for the Settings.apk and find where it displays that 'last sync' textview, and the data that is used to populate it. – RyanInBinary Aug 07 '12 at 17:44