Big commit.
Managed to do upload and download right. No Race conditions.
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
package com.dano.test1
|
||||
|
||||
import android.app.Application
|
||||
import android.util.Log
|
||||
import androidx.room.Room
|
||||
import androidx.room.RoomDatabase
|
||||
import com.dano.test1.data.AppDatabase
|
||||
|
||||
class MyApp : Application() {
|
||||
@ -13,12 +15,21 @@ class MyApp : Application() {
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
// Room Datenbank bauen: nur die Hauptdatei, ohne WAL und Journal
|
||||
database = Room.databaseBuilder(
|
||||
applicationContext,
|
||||
AppDatabase::class.java,
|
||||
"questionnaire_database"
|
||||
)
|
||||
.fallbackToDestructiveMigration()
|
||||
.setJournalMode(RoomDatabase.JournalMode.TRUNCATE) // TRUNCATE = keine -wal Datei, nur Hauptdatei
|
||||
.addCallback(object : RoomDatabase.Callback() {
|
||||
override fun onOpen(db: androidx.sqlite.db.SupportSQLiteDatabase) {
|
||||
super.onOpen(db)
|
||||
Log.d("DB", "Datenbank geöffnet. Nur questionnaire_database wird genutzt.")
|
||||
}
|
||||
})
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user