Closed blonsky95 closed 4 years ago
add it as parameter in AppRoomDatabase and I think that should be it
WORKING!!!!!
So the gist on this one was actually not adding the userid to the parameter to build the custom database (that was the easy thing). But the problem is when you dont close the app completely the db instance doesnt die, so when you log out and use a different user, the build database is not called because "instance" (of db) is not null and thus no need to create a different one.
To tackle this I created a
fun destroyInstance() {
if (instance?.isOpen==true) {
instance?.close()
}
instance=null
}
function which when called, destroys the instance/makes it null, this function atm is only called by the log out function, which is triggered from HomeViewModel, which is triggered by the log out selectable item in the top right corner menu.
So basically if 2 users log into one same phone, I dont want the app to download all the info for each. Instead each of the users will be storing all their stuff in a different database, and then depending on the user id it will access its own db.