Optimize background Workers, remove redundant JobServices
1. Adapt the location callback in WeatherWorker to coroutines 2. Merge EventListenerJob into UpdateCalendarWorker 3. Remove BatteryListenerJob, as it's impossible to use Jobs to detect battery status
This commit is contained in:
@ -42,12 +42,12 @@ class WeatherReceiver : BroadcastReceiver() {
|
||||
5 -> 60L * 24
|
||||
else -> 60
|
||||
}
|
||||
WeatherWorker.enqueue(context, interval, TimeUnit.MINUTES)
|
||||
WeatherWorker.enqueuePeriodic(context, interval, TimeUnit.MINUTES)
|
||||
}
|
||||
}
|
||||
|
||||
fun removeUpdates(context: Context) {
|
||||
WeatherWorker.cancel(context)
|
||||
WeatherWorker.cancelPeriodic(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user