I am developing a project in which I am trying my hand on Realm.
Its auto syncing functionality is awesome but now I want to share data between two realm users.
So Scenario is: Say I have two users "A" and "B", When "A" update anything in table "X" then "B" should be able to see those changes, so basically they both are dealing with the same table and not two realms.
If this is not possible than I have heard/read about realm functions, So by using functions can we add/update B's realm whenever "A" update his realm with the same data?
Letting multiple users work together on a realm is one of the use cases for Realm Object Server. You can use android demo app as a starting point.
Related
Actually I've an app with some local data, and I used Realm to store them. Today I would like to update it, and switch to Room.
The thing is that some user already have data stored with Realm, and for now, my app only store the data locally, there is no cloud of something. This means that if I just switch from Realm to Room, some existing user will lost their data.
I made some search, and I thought about, when the user will open the app, make a query of all the Realm data, and switch them to Room, keep it for few weeks, and then delete Realm.
The thing is that I made a test project to see if it's functional, but I noticed that I will have to create the model twice (the existing one with Realm and the new one with Room).
Does someone have a better idea or way to do it, or it's my only way to go ?
I am developing an Android application. Actually my app is for Societies/Apartments use. And I am using Firebase to store all the data of the app. I have a Firebase database and I want to assign one instance of Database to one society. Like Society A will have one instance of database. Society B will have another instance of same Database. And so on. And master database will have the link of all its instances of database.
How can I achieve it?
I also wanted to know How many instances of a database can we create in Firebase for one project?
firebaser here
The ability to have multiple instances of the Realtime Database is to allow it to scale beyond the capabilities of a single database. This is known as sharding, as key to this approach is dividing your entire user-base into separate shards, where the shards have minimal interaction with each other.
You should consider however if you really need a separate shard for each society/apartment. I recommend studying When to shard your data carefully and see if your usage is really going to go beyond the scalability abilities of a realtime database instance. While technically sharding sounds very possible with your scenario, using shards complicates matters significantly, so you should only use this when it is actually needed.
E.g. you could easily start of by segmenting the data for the societies/apartments into separate branches in a single database instance:
/apt1
users
groups
places
/apt2
users
groups
places
/apt3
users
groups
places
Then if you ever reach the need to shard, you can move some of these apartments into another database instance, and use a master database (or an implicit key mapping, which typically scales better) to tie users/apartments to a database instance.
There is no documented limit on the number of shards. Each database instance is quite literally that: a separate database with its own URL, (possibly) on different infrastructure, etc. There probably is a physical limit to how many instances can be created, but I would again refer back to the previous paragraph: if you find yourself creating hundreds of shards, you're probably using them for more than is needed.
We have an app (A1) with significant number of users still active, but we no longer plan to support the app. Now we have another smaller app (A2), which is similar to A1.
Is there any way that when users from A1 update their app from the Play Store that they get A2? Basically, we want to migrate users from A1 to A2.
Of note, the package names are different.
It All depends upon the database. You should research about the database you are using for your app to store users data. Connect the same database to your new app or just copy the all users data from A1's Database to the A2's Database, and implementation for all this depends on your database implementation.
Share your more information about your database, this may help you to get a answer.
You could do this implementation maybe in another language like JavaScript etc. Then in A2 use the same implementations ti read and write the data in users.
But beware that you copy data using the same database structure as you used in A1's Database
I write android app using MVP pattern. My question is regarding database layer. I want to make it maximally independent, so it will be possible to replace it with something else without code changing in Presenter in the future. I decided to use pure SQLite without ORM, since the user table is updated in different places with differenet fields (in some place I update user's name, in other place in code - token etc.). ORM (I used realm) doesn't allow to do it, you have to write separate method for updating name, separate - for token etc.
Another problem is with ContentValues: when you update user you have to specify the fields you want to change via ContentValues in Presenter, and then Presenter calls repository.updateUserLocal(contentValues), so my Presenter dependents on data layer (if I decided to add ORM to the project, I will need to go to every Presenter and remove ContentValues). So the architecture is bad. Can you please advice how to organize the architecture of the app in the best way?
I'm a self taught android programmer so sorry if this is a newbie question. Does anyone know if there's an easy way to merge two realm database files into one combined realm database? The databases contain the same realmobject types and are mutually exclusive (no overlaps of identical objects).
My goal is this: I have a realm database of a workout "session" that is comprised of a list of objects that the user adds to using a wearable. When the user saves the session, I want to send those saved objects to the phone where it can be combined with all past sessions in a realm database stored on the phone.
I'm able to send the database file from wear to phone as an asset and simply replace the file on the phone (using this sample code https://gist.github.com/tajchert/dc30560891bc6aee76fb), but it seems wasteful to send the entire database every time, and I don't want to lose everything if the wear database gets deleted somehow. I'd rather save only the new data from the current session and then clear out the database on the wearable when a new session is started. That way, I'm only ever sending new data to the wearable data layer.
In general, it is not possible to move Realm objects between Realms. You can use copyFromRealm() and copyToRealm(). Of course, you will need to keep track of which objects, which are already been moved (either my marking them somehow or deleting them).
Another option is to use Realm Mobile Platform (https://realm.io/products/realm-mobile-platform/) which can help you to keep all your devices in-sync.