X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyCell.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacycell%2Fworkers%2FRestartServiceWorker.kt;fp=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacycell%2Fworkers%2FRestartServiceWorker.kt;h=64b4eca93811a434e1e2d55349b18b1b2af16805;hp=0000000000000000000000000000000000000000;hb=9ee51bf9fbf3ef3e463456c4a4e4ef626eab3412;hpb=0797811d24cfaab7a49ec071c8a752e950213981 diff --git a/app/src/main/java/com/stoutner/privacycell/workers/RestartServiceWorker.kt b/app/src/main/java/com/stoutner/privacycell/workers/RestartServiceWorker.kt new file mode 100644 index 0000000..64b4eca --- /dev/null +++ b/app/src/main/java/com/stoutner/privacycell/workers/RestartServiceWorker.kt @@ -0,0 +1,37 @@ +/* + * Copyright © 2021 Soren Stoutner . + * + * This file is part of Privacy Cell . + * + * Privacy Cell is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Privacy Cell is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Privacy Cell. If not, see . + */ + +package com.stoutner.privacycell.workers + +import android.content.Context +import android.content.Intent + +import androidx.work.Worker +import androidx.work.WorkerParameters +import com.stoutner.privacycell.services.RealtimeMonitoringService + +class RestartServiceWorker(appContext: Context, workerParameters: WorkerParameters) : Worker(appContext, workerParameters) { + override fun doWork(): Result { + // Start the realtime monitoring service as a foreground service, which is required because the worker is running in the background. + applicationContext.startForegroundService(Intent(applicationContext, RealtimeMonitoringService::class.java)) + + // Return a success. + return Result.success() + } +} \ No newline at end of file