]> gitweb.stoutner.com Git - PrivacyCell.git/blobdiff - app/src/main/java/com/stoutner/privacycell/workers/RegisterRealtimeListener.kt
Remove unneeded permissions added by `androidx.work`. https://redmine.stoutner.com...
[PrivacyCell.git] / app / src / main / java / com / stoutner / privacycell / workers / RegisterRealtimeListener.kt
index b2cd8346a3ea8f0cba424c0ec11f2e17f9b9d1ab..86774708ed0f58208a1d9908417b92c8cd682c2f 100644 (file)
@@ -53,8 +53,8 @@ class RegisterRealtimeListener (appContext: Context, workerParams: WorkerParamet
 
             // Check to see if the service is currently running.
             if (runningServiceInfoList.isEmpty()) {  // The service is currently stopped.
-                // Start the service.
-                applicationContext.startService(Intent(applicationContext, RealtimeMonitoringService::class.java))
+                // Start the service as a foreground service, which is required because the worker is running in the background.
+                applicationContext.startForegroundService(Intent(applicationContext, RealtimeMonitoringService::class.java))
             } else {  // The service is currently running.
                 // Create a service connection.
                 val serviceConnection = object : ServiceConnection {