I'm just getting to know about Android Room Database.
When I was using Realm Database, I had to care if Realm DB instance was opened or closed.
So I managed it by .use
in my kotlin code.
RealmProvider(context).getDatabase().use { database ->
if (database == null) {
it.onError(Exception("DataBase Open Error !"))
} else {
database.executeTransaction { realm -> realm.insert(SomeData) }
it.onComplete()
}
}
However; in Room DB, no one use roomDatabase.close()
in their codes.
So I'm wondering when Room DB is closed and opened and also when db instance is allocated and free on RAM memory.