Reputation: 23
I'm relatively new to building mobile apps in general, but I am an experienced web developer.
Let's say I am building a to-do list app. Android users can create lists and populate them with items. Lists and their contents will be saved on the device via Realm DB.
Some lists can be "Shared" with others. Modifications to the list would show up in real time across all users who are collaborating on a list.
I plan to have an online server that stores the list, user info, etc. With that being said, is it relatively trivial to register my mobile app to a "web sockets like" interface with the server to get real time DB syncs?
I assume this would be accomplished with saving data on the server via a relational DB like MySQL or PostgreSQL and provide JSON payloads when the database has changed.
Is it simple to have the Android app listen for changes coming from the server, sorta like web sockets? I understand I'll have to manage conflicts, network availability, etc.
Upvotes: 0
Views: 3175
Reputation: 2711
Many mobile applications require to sync data with a server if they operate in the client – server model to exchange data with the central repository.
If the server serves up resources through a REST API, then all sync logic can be handled on the client side. The sync logic is able to handle bi-directional sync between central server and multiple clients where only incremental changes apply on both sides with some conflict detection.
http://havrl.blogspot.in/2013/08/synchronization-algorithm-for.html
Upvotes: 0
Reputation: 238
I would suggest you to use Firebase. As real time synchronization is quite simple in that. As it stores last updated data at device, so you don't have to worry about data changes happening at server side. When it gets connected to internet it automatically synchronizes the latest data and stores it to the offline storage. And it stores data in json format
Upvotes: 2