diff --git a/id/src/main/AndroidManifest.xml b/id/src/main/AndroidManifest.xml
index 08b9ae3513..86a11c38ab 100644
--- a/id/src/main/AndroidManifest.xml
+++ b/id/src/main/AndroidManifest.xml
@@ -4,6 +4,7 @@
+
@@ -22,8 +23,14 @@
+
+
= Q then use FOREGROUND_SERVICE_TYPE_DATA_SYNC
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ startForeground(1, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)
+ } else {
+ startForeground(1, notification)
+ }
}
}
diff --git a/infra/core/src/main/java/com/simprints/core/workers/SimCoroutineWorker.kt b/infra/core/src/main/java/com/simprints/core/workers/SimCoroutineWorker.kt
index 3268b1c408..78b6d51256 100644
--- a/infra/core/src/main/java/com/simprints/core/workers/SimCoroutineWorker.kt
+++ b/infra/core/src/main/java/com/simprints/core/workers/SimCoroutineWorker.kt
@@ -5,6 +5,7 @@ import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
+import android.content.pm.ServiceInfo
import android.os.Build
import androidx.core.app.NotificationCompat
import androidx.work.CoroutineWorker
@@ -98,7 +99,11 @@ abstract class SimCoroutineWorker(
}
}
.build()
- return ForegroundInfo(WORKER_FOREGROUND_NOTIFICATION_ID, notification)
+ return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ ForegroundInfo(WORKER_FOREGROUND_NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)
+ } else {
+ ForegroundInfo(WORKER_FOREGROUND_NOTIFICATION_ID, notification)
+ }
}
protected fun crashlyticsLog(message: String) {