Fix Android 12 preventing the restarting of the monitoring service. https://redmine...
[PrivacyCell.git] / app / src / main / java / com / stoutner / privacycell / services / RealtimeMonitoringService.kt
index 5aa98f8284d5e201b2ac433f302e65ba294f2a95..7d467dd1d2576165407af96325896c9d6cf0d90d 100644 (file)
@@ -42,7 +42,7 @@ import androidx.work.WorkManager
 
 import com.stoutner.privacycell.R
 import com.stoutner.privacycell.activities.PrivacyCellActivity
-import com.stoutner.privacycell.workers.RegisterRealtimeListener
+import com.stoutner.privacycell.workers.RegisterRealtimeListenerWorker
 
 import java.util.concurrent.TimeUnit
 
@@ -187,7 +187,7 @@ class RealtimeMonitoringService : Service() {
         if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
             // Create a register realtime listener work request that fires every hour.
             // This periodic request will fire shortly after being created (it fires about every hour near the beginning of the hour) and will reregister the listener if it gets garbage collected.
-            val registerRealtimeListenerWorkRequest = PeriodicWorkRequestBuilder<RegisterRealtimeListener>(1, TimeUnit.HOURS).build()
+            val registerRealtimeListenerWorkRequest = PeriodicWorkRequestBuilder<RegisterRealtimeListenerWorker>(1, TimeUnit.HOURS).build()
 
             // Register the realtime listener work request.
             WorkManager.getInstance(this).enqueueUniquePeriodicWork(getString(R.string.register_listener_work_request), ExistingPeriodicWorkPolicy.REPLACE, registerRealtimeListenerWorkRequest)