Closed miketrinh1995 closed 7 years ago
Well it is possible to make Realm into a real-time database if you run a Realm Object Server somewhere and you enable sync mode and use a SyncConfiguration ( see here )
@Zhuinden Thank you! So, I have to buy a server or use a virtual machine, I'm using Windows OS ?
Realm Object Server (ROS) runs on Mac OS or Linux.
But of course, if you can make Firebase do what you want, then you could use Realm Mobile Database with it as you normally would. I haven't done that before because I don't use Firebase, so I can't help with that.
@Zhuinden I'll try Realm Object Server. Thank you so much!
After 1 day, I know how to connect Realm Database with Firebase Database server. It's working perfectly like Realm Object Sever. If anybody has the same problem with me, contact me.
@trinhvanminh2009 hi I'm wondering how you do this, can you do with cloudKit as well?
@trevor-sonic I have no ideas about that. I'm using Firebase Database instead of use Real-object! About cloudKit, I'm an android developer, I don't know anything about IOS developer!
@trinhvanminh2009 can I know how u did it ? or, can u give me the material that help u to do it ?
@magician20 It's a lot of steps to do. If you want more detail. Contact me on Facebook https://www.facebook.com/minh.trinh.52493
@trinhvanminh2009 It would be great if you could write a gist explaining the steps and share it here. Cheers
ye I hope Too:).
@urbangeek @magician20 The simple ideas are:
This is how I did it. I wrote an interface which does crud operations for a table. So one implementation did initially Realm, including opening and closing it. Next I wrote a new implementation which this time embedded the first one, and there I kept updating Realm, and updating Firebase. Since I mentioned I wrote opening and closing, I could start and stop watching live changes in Firebase. So the live updates helped me to add/update/delete my realm objects. In this situation your app will rely on the Firebase implementations not knowing about it.
If you already started using Realm, you can just check if the Firebase is empty meaning it's time to push all Realm data into Firebase. In contrast if you installed an app in a new device, and you already have data in a Firebase object, then the live event will keep popping letting you know of each new object, so it's time for Realm to add each one of them.
In my case I had already a Realm class which used a primary key as integer. Since the data is not shared with other users, I set it as a string key in Firebase. Lets say you have a free version of your app, and the paid version is going to be hooked into Firebase, I would recommend applying a self generated string as primary key. In this way you are doing the same thing Firebase does, but without using Firebase initially. I hope this gives some insight.
I also want to share that in my case a Realm object threw an exception in Firebase meaning it couldn't use serialized objects. So a solution was to write a utility class which cloned my real Realm object, and that was it for Firebase. Maybe I should have used instead realm.copyFromRealm(realmObject)
I have a Android project, using realm to build the database. I need a server with a real-time database. How I can do that. Give me a solution. Thank you!