X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyCell.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacycell%2Fworkers%2FRegisterRealtimeListener.kt;fp=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacycell%2Fworkers%2FRegisterRealtimeListener.kt;h=86774708ed0f58208a1d9908417b92c8cd682c2f;hp=b2cd8346a3ea8f0cba424c0ec11f2e17f9b9d1ab;hb=0797811d24cfaab7a49ec071c8a752e950213981;hpb=6ee1470b74f7643f50bf7f1ebfdb578dcac829f2 diff --git a/app/src/main/java/com/stoutner/privacycell/workers/RegisterRealtimeListener.kt b/app/src/main/java/com/stoutner/privacycell/workers/RegisterRealtimeListener.kt index b2cd834..8677470 100644 --- a/app/src/main/java/com/stoutner/privacycell/workers/RegisterRealtimeListener.kt +++ b/app/src/main/java/com/stoutner/privacycell/workers/RegisterRealtimeListener.kt @@ -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 {