Upgrade targetSdk to 34

This commit is contained in:
Koitharu
2023-08-14 15:10:08 +03:00
parent 7e31b1384e
commit 925c24471e
11 changed files with 68 additions and 25 deletions

View File

@@ -2,6 +2,7 @@ package org.koitharu.kotatsu.tracker.work
import android.app.PendingIntent
import android.content.Context
import android.content.pm.ServiceInfo
import android.os.Build
import androidx.core.app.NotificationChannelCompat
import androidx.core.app.NotificationCompat
@@ -258,7 +259,11 @@ class TrackWorker @AssistedInject constructor(
.setSmallIcon(android.R.drawable.stat_notify_sync)
.setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_DEFERRED)
.build()
return ForegroundInfo(WORKER_NOTIFICATION_ID, notification)
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
ForegroundInfo(WORKER_NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)
} else {
ForegroundInfo(WORKER_NOTIFICATION_ID, notification)
}
}
private suspend fun setRetryIds(ids: Set<Long>) = runInterruptible(Dispatchers.IO) {