4

I am creating an app which have synchronised data with an online server. What is the best approach?

I thought having a local database (SQLite) which will synchronise with an online database with the same structure. Would it be better an online XML or an online database?

Other question. Is there any algorithm known for data synchronisation ?

Thiago C. S Ventura
  • 2,448
  • 1
  • 29
  • 43

1 Answers1

1

The best practice is to model your application using a content provider and then connect a sample sync adapter. http://developer.android.com/resources/samples/NotePad/index.html http://developer.android.com/resources/samples/SampleSyncAdapter/index.html

You can find these sample in the Android SDK. In Eclipse,

File >
New >
Android Project >
Create project from existing sample >
Android 2.1 >
Select desired project

(Things start to change once you hit the tablets and Android 4.0, so 7 or 8 are your best bets.)

The blog post below explains the Sync Adapter well. http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/

If you want to start quickly, parse your XML, and then wrap your SQLite implementation around it, use the following link. http://andrewgertig.com/2010/07/android-and-ruby-on-rails/

dpott197
  • 1,060
  • 1
  • 9
  • 11