Loading app/src/main/java/at/bitfire/davdroid/ForegroundService.kt +10 −8 Original line number Diff line number Diff line Loading @@ -52,7 +52,8 @@ class ForegroundService : Service() { * Starts the foreground service when enabled in the app settings and applicable. */ fun startIfActive(context: Context) { if (foregroundServiceActivated(context) && batteryOptimizationWhitelisted(context)) { if (foregroundServiceActivated(context)) { if (batteryOptimizationWhitelisted(context)) { val serviceIntent = Intent(ACTION_FOREGROUND, null, context, ForegroundService::class.java) if (Build.VERSION.SDK_INT >= 26) context.startForegroundService(serviceIntent) Loading @@ -61,6 +62,7 @@ class ForegroundService : Service() { } else notifyBatteryOptimization(context) } } private fun notifyBatteryOptimization(context: Context) { val settingsIntent = Intent(context, AppSettingsActivity::class.java).apply { Loading Loading
app/src/main/java/at/bitfire/davdroid/ForegroundService.kt +10 −8 Original line number Diff line number Diff line Loading @@ -52,7 +52,8 @@ class ForegroundService : Service() { * Starts the foreground service when enabled in the app settings and applicable. */ fun startIfActive(context: Context) { if (foregroundServiceActivated(context) && batteryOptimizationWhitelisted(context)) { if (foregroundServiceActivated(context)) { if (batteryOptimizationWhitelisted(context)) { val serviceIntent = Intent(ACTION_FOREGROUND, null, context, ForegroundService::class.java) if (Build.VERSION.SDK_INT >= 26) context.startForegroundService(serviceIntent) Loading @@ -61,6 +62,7 @@ class ForegroundService : Service() { } else notifyBatteryOptimization(context) } } private fun notifyBatteryOptimization(context: Context) { val settingsIntent = Intent(context, AppSettingsActivity::class.java).apply { Loading