diff --git a/app/src/main/java/com/rosan/dhizuku/data/settings/model/room/DhizukuRoom.kt b/app/src/main/java/com/rosan/dhizuku/data/settings/model/room/DhizukuRoom.kt index 4bb816b..17fc467 100644 --- a/app/src/main/java/com/rosan/dhizuku/data/settings/model/room/DhizukuRoom.kt +++ b/app/src/main/java/com/rosan/dhizuku/data/settings/model/room/DhizukuRoom.kt @@ -23,7 +23,7 @@ abstract class DhizukuRoom : RoomDatabase() { fun createInstance(): DhizukuRoom { var context: Context = get() if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N - && context.isDeviceProtectedStorage + && !context.isDeviceProtectedStorage ) { context = context.createDeviceProtectedStorageContext() } diff --git a/app/src/main/java/com/rosan/dhizuku/server/RunningService.kt b/app/src/main/java/com/rosan/dhizuku/server/RunningService.kt index 897b6ec..5e3bcb4 100644 --- a/app/src/main/java/com/rosan/dhizuku/server/RunningService.kt +++ b/app/src/main/java/com/rosan/dhizuku/server/RunningService.kt @@ -26,7 +26,10 @@ import org.koin.core.component.inject class RunningService : Service(), KoinComponent { companion object { fun start(context: Context) { - context.startService(Intent(context, RunningService::class.java)) + val intent = Intent(context, RunningService::class.java) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) + context.startForegroundService(intent) + else context.startService(intent) } }