Sync data between users in Android App without server -


i developing android app has list, list synced between multiple users - can done with out server side?

syncing data between webserver , android app requires couple of different components on android device.

persistent storage:

this how phone stores data receives webserver. 1 possible method accomplishing writing own custom contentprovider backed sqlite database.

a contentprovider defines consistent interface interact stored data. allow other applications interact data if wanted. behind contentprovider sqlite database, cache, or arbitrary storage mechanism.

while recommend using contentprovider sqlite database use java based storage mechanism wanted.

data interchange format:

this format use send data between webserver , android app. 2 popular formats these days xml , json. when choosing format, should think sort of serialization libraries available. know off-hand there's fantastic library json serialization called gson: http://code.google.com/p/google-gson/, although i'm sure similar libraries exist xml.

synchronization service

you'll want sort of asynchronous task can new data server , refresh mobile content reflect content of server. you'll want notify server whenever make local changes content , want reflect changes. android provides syncadapter pattern way solve pattern. you'll need register user accounts, , android perform lots of magic you, , allow automatically sync. here's tutorial: http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/

as how identify if records same, typically you'll create items unique id store both on android device , server. can use make sure you're referring same reference. furthermore, can store column attributes "updated_at" make sure you're getting freshest data, or don't accidentally write on newly written data..


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -