package com.flacksta.chef.journeygpstracker import android.app.Application import android.util.Log import com.flacksta.chef.journeygpstracker.database.GpsData import com.flacksta.chef.journeygpstracker.database.GpsPosRepository import com.flacksta.chef.journeygpstracker.database.GpsPosRoomDatabase import kotlinx.coroutines.* class JourneyGpsTrackerApplication : Application() { val applicationScope = CoroutineScope(SupervisorJob()) val database by lazy { GpsPosRoomDatabase.getDatabase(this, applicationScope) } val repository by lazy { GpsPosRepository(database.gpsDataDao()) } override fun onCreate() { super.onCreate() Log.i("JourneyGpsTrackerApplication","onCreate()") initStuff() } fun initStuff() = runBlocking { // this: CoroutineScope launch { //repository.deleteAll() repository.doAnInitOperationOnTheDb() } } }