Prefilled realm object server database - android

Is it possible to keep initial version(prefilled) of realm database to Realm Object Server which will be synchorized once user authorized first time?
Then users will be able to read/modify their copies. It is not multiediting - every user has it's own database, just prefilled from a server.

Yes, you can. You can setup a Realm function that monitors either when the user is created or when they access the Realm for the first time, and then let the server fill the Realm.

Related

How firebase store variable in database when there is no internet and deliver these variable later

I want to understand how can firebase store object data for later delivery when the target devices has no internet connection. Because i want to create my one method that store a list of string when there is no connection and send them right after the connection is available.
Firebase has two databases these days: the Firebase Realtime Database, and Cloud Firestore. Luckily for the scope of your question their behavior is quite similar, but you'll typically want to specify which database you're asking about in your question.
When you make a change to the data in your app, Firebase does two things:
It updates its local snapshot of the data, and firebase local events for the change.
It sends the change to the server, to commit it to the permanent storage there.
If your app is not connected to the server, it puts the change in a queue of so-called pending writes. If you have disk persistence enabled that queue is written to disk, but otherwise it just exists in memory.
When the app is running and has a network connection, Firebase sends any pending writes to the server.
You can use a Sqite for store data then if internet available then sent data to firebase. Need some basic logical program.
Create Database in your application and make one class which save data in your database
.when the user went to save data in firebase,checking connection if no save data in firebase and the first time that user open app with connection try to save it in firebase and delete data from data base
look more information at this doc

Every time user logs in the realm object server creates a new realm

I'm using synced realm and I'm supporting user login with name and password.
Now the user is able to login and do the stuff but if the same user logs in to another device It will create a new realm and will not get the data from the previous realm. The problem here is every time the user logs in it creates a new realm on the realm object server and it doesn't get the data stored in previous realm. Tried a many ways like changing configurations and other related work around but still no result.
Any idea or suggestion on why there are being created new realms for each user's login where as I'm just logging the user to get the same data from server.

Link Android Room Database with Firebase Realtime Database

I am using Android Room Database for creating the database for my android app. It works perfectly for me locally but I cannot link to a server to have it online as well.
I am using Firebase for Authentication. I am trying to use Firebase Realtime Database to save the whole database object from Room and load the correct database on app startup according to the authenticated user.
I want to ask if this is possible at all? and if I can just save a whole instance of Room database or I need to re-create the database on Firebase and save my data item by item?
I also can't seem to be able to get access to the database data of Room, as when I get an object of the AppDatabase class it doesn't really pass the data. And I don't know how should do the opposite, to assign the data retrieved from Firebase later to the local data saved?
Also if it's not possible with Firebase, do you have any recommendation for some other server I can use with Room?
After a lot of researches and looking desperately for an answer here's what I reached:
Firebase already got a straight forward way to create the database and host it online. (I had my database already created so was trying to save time, but creating it from scratch using Firebase Realtime Database was a lot faster)
Room Database is quite perfect if you are planning to save your database locally and offline (Up to the post date)
I think their is no need to connect your Room Database with Firebase Realtime database because,okay first try to solve this problem, why we use Room Database ?because when we don't have internet, we can get data from Room Database , no need of network... Firebase also provides offline mode , it can also save data in persistence, so why we use Room Database ?.. Hope you got the point...
Similar project created by me which uses
Firebase authentication to login user
Save and cache user notes to sql lite database with Room
Save user notes to firebase base database
✍️ Simple Note Making App use Sqllite Room 🧰 for caching the notes and 📥 Firebase Database for online storage
https://github.com/LanguageXX/Simple-Note-App-with-Online-Storage
Hope that helps you

Accessing multiple realm databases simultaneously

I have two users who have made realm databases. User1 has given admin access level to User2. Both create a list of objects. How can User2 get a list of objects made by himself and User1?
Currently User2 can access only 1 realm database on signing in.
I am using android.
If you are having two db, means you have two RealmConfiguration, one for each. You can get the realm appropriate db by calling Realm realm = Realm.getInstance(realmConfigurationInstance). Whichever, configuration you will pass, you will get that instance of the db.

Send data to Realm object server from app

I am creating an Android application in which I am using the Realm database to store data, and I am using the Realm object server to login and register user. I am able to log a user in using SyncUser and I am able to see that my login user has been stored in the Realm object server.
But now I have additional fields that I want to store - for instance, mail and age. I know how I'd store it in a different database but I don't know how to do this in Realm.
If you are talking about storing metadata about a user. That is not supported yet, but will be added soon. You can follow https://github.com/realm/realm-java/issues/4645. For now the workaround would be to save them in your own custom User Object.

Categories

Resources