Reputation: 459
I'm developping an app with a login function to a backend solution when launched. When new user is created I'm saving some user data into the Realm database. Evrything works fine.
However I was wondering, if the user log out and a friend log in on the same smartphone. Either if the friend is a new user or already have an account registered, the data in realm are those of the first user.
So do I have to reset all Realm database in my app when log out and fill it if a user is already registered ?
Is it the best process ?
Upvotes: 4
Views: 2350
Reputation: 20126
The easiest solution would be to create a new Realm file for each user, then multiple users can use the device without loosing their data if another logs in.
It isn't clear what platform you are working on, but both the Android and iOS versions have the option of specifying a name for your Realm file.
Upvotes: 3