M Vamshi Krishna
M Vamshi Krishna

Reputation: 41

Realm Android Sync operation with the database

Does Realm Android support Sync operation with the database. We are actually looking to freeze on a Technology for storing the data in Local DB and further syncing with the Remote DB.

Upvotes: 4

Views: 3637

Answers (3)

EpicPandaForce
EpicPandaForce

Reputation: 81588

This use-case is now allowed by the Realm Mobile Platform and the Realm Object Server.

The Realms are synchronized automatically and real-time, and have offline-caching functionality.

EDIT: Now in 2018-03-23, the pricing model is somewhat in a flux during the 2.x -> 3.x transition. Realm offers a Cloud platform, more details on their site. Either way, that syncs real-time between cloud ROS and the local db clients.

Upvotes: 3

Thesoham24
Thesoham24

Reputation: 194

You can achieve this by adding 'isUpdatedOnServer' field in RealmModel and setting initial value as 'false'

you may perform sync like this. ("isUpdatedOnServer","false").findAll();, after successful response, you can update "isUpdatedOnServer" field to 'true'.

Upvotes: 0

timanglade
timanglade

Reputation: 371

Realm does not have any built-in sync as of now (October 2015). This is something that is on our radar (tracked on the cocoa project for historical reasons but applicable to all our libraries). In the meantime it’s relatively trivial to exchange data in & out of Realm via a REST API; our docs include quick examples of how to access a REST API with Realm & Retrofit.

Upvotes: 3

Related Questions