问题
I am in the early stages of an Android project that will be using a database, hopefully Realm. I want users to be able to access the same database from multiple Android devices (logged in to the same Google account). I am considering placing the Realm files in the Google Drive App folder.
I've done some searching, but have found no discussions of this particular configuration.
I have no prior experience with either Realm or the Google Drive API, so I'm concerned that there may be some fatal flaw(s) with this approach.
Any insights/advice appreciated.
回答1:
Edit: Since I answered this question, Realm launched the Realm Mobile Platform, which is precisely intended for doing this kind of job: Sync an application using a Realm database as the question describes. My previous answer is now obsolete.
Previous answer: Right now isn't possible to synchronize Realms through devices and keep the app "up to date" everywhere.
There is a similar question in the Github Issues in Realm: How to synchronize Realm data across multiple iOS/Android devices?
From one of the Realm's maintainers:
Since Realm supports JSON importing, interacting with a Web API is probably the best way to synchronize data between devices. See Realm's Rest APIs docs.
However this is a feature they're working on. You can track the realm-cocoa Issue #913 expecting changes in this way.
So, I agree with the comments I cited previously and recommend you to sync your applications using the API.
来源:https://stackoverflow.com/questions/34665259/store-realm-files-in-google-drive-app-folder