From cd1d3df08751276b7b9aea76f2e667f71289bfe3 Mon Sep 17 00:00:00 2001 From: Jonas Kalderstam Date: Fri, 19 Apr 2024 21:10:48 +0200 Subject: [PATCH] Fixed foreground service changes in Android 14 --- app/src/main/AndroidManifest.xml | 9 +++++++++ .../feeder/model/workmanager/BaseWorker.kt | 4 ++++ settings.gradle.kts | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 80955a952..a1fe9b05b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@ + + + + + diff --git a/app/src/main/java/com/nononsenseapps/feeder/model/workmanager/BaseWorker.kt b/app/src/main/java/com/nononsenseapps/feeder/model/workmanager/BaseWorker.kt index 4ccfdaa8c..073586b70 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/model/workmanager/BaseWorker.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/model/workmanager/BaseWorker.kt @@ -35,6 +35,10 @@ private fun createNotificationChannel( notificationManager.createNotificationChannel(channel) } +/** + * Necessary for expedited work. + * Pre Android 12 they will run as foreground services, but on Android 12+ they will run as expedited Jobs. + */ fun createForegroundInfo( context: Context, notificationManager: NotificationManagerCompat, diff --git a/settings.gradle.kts b/settings.gradle.kts index ddc99bb98..264cdac8f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -48,7 +48,7 @@ dependencyResolutionManagement { version("qrgen", "2.6.0") version("androidxCore", "1.10.1") version("androidxTestcore", "1.5.0") - version("workmanager", "2.8.1") + version("workmanager", "2.9.0") version("appcompat", "1.6.1") version("material", "1.6.1") version("preference", "1.2.1")