Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ways to Sync Data in mobile (Android)

Ways to Sync Data in mobile (Android)

Selvakumar Natesan

October 29, 2013
Tweet

More Decks by Selvakumar Natesan

Other Decks in Programming

Transcript

  1. About The Application Quick overview Transform class room teaching and

    learning Using Android Tablets For school teachers and students More effective With classroom activities And assignments · · · · · ·
  2. Challenges Share Content Assignments · Videos eBooks Documents - -

    - · Reading Quiz Short Answer Explore - - - - Inclass Activities · Discussions Comments Quick Poll Call a student (randomly) - - - -
  3. What exactly is the problem Now the technical part Push

    Content In realtime To 1000s of tablet concurrently Broadcast - sometimes To a subset of tablet - sometimes Offline Platform - Support multiple apps · · · · · · ·
  4. Poll for data changes Pros Cons Tablet posts the content

    to server Poll for its content At regular intervals With android services The server returns only the deltas · · · · · Simplest Solution Possible Offline tablets gets the data back when online · · Createing contents Offline (Read Only) Server scalling Battery life · · ·
  5. XMPP Pros Cons Group Chat! Openfire - xmpp server asmack

    - xmpp client for android Messages which are time critical Class attendance OK if offline tablets misses them · · · · · · 0 server side code Good for chat like interactions · · Persistent messages Scaling - cocurrent connections Reliability · · ·
  6. GCM Google Cloud Messageing Pros Cons Push notifications Messages upto

    4k Collapsing · · · Good for battery life Server side scalling - no polling · · Still readonly while offline Not 100% reliable · ·
  7. Event Souring http://martinfowler.com/eaaDev/EventSourcing.html Capture appliaction state as events As a

    sequence Can be applied in the same order to get the current state Like a Version Control System All parties in the system just speaks events · · · · ·
  8. Event Sourcing Structure of an Event { " u u

    i d " : " 0 0 0 0 0 1 3 a - e 6 b e - 8 1 4 8 - 1 2 c 5 - 0 3 6 0 6 0 2 e c 2 7 8 " , " t i m e s t a m p " : 1 3 6 6 3 8 8 8 1 4 , " e v e n t T y p e " : " P o s t C r e a t e d E v e n t " , " c r e a t e d B y U s e r I d " : 1 , " a u t h T o k e n " : " s o m e a u t h t o k e n " , " d a t a " : { " s o m e A t t r i b u t e " : " s o m e V a l u e " , " a n o t h e r A t t r i b u t e " : " a n o t h e r V a l u e " } , " s c o p e " : [ 1 , 1 2 0 3 , 3 4 5 ] } J S O N
  9. Event Sourcing Pros Cons Data agnostic service Each node can

    device what to listen to Scaling · · · Every party needs to talk event Very hard to integrate with non-event based systems · ·
  10. Using CouchDB A NoSQL datastore Distributed - replica copies Schema

    free JSON documents Incremental master-master replication · · · · ·
  11. TouchDB Light weight CouchDB compatible Uses SQLite Good enough for

    mobile Replicate data with CouchDB · · · · ·