fix: declare dataSync type when starting foreground download service

Use the 3-arg startForeground overload with FOREGROUND_SERVICE_TYPE_DATA_SYNC on API 29+ so the runtime FGS type matches the manifest declaration. Silences the ForegroundServiceTypeLoggerModule warning on targetSdk 36.
This commit is contained in:
zarzet 2026-05-08 00:05:52 +07:00
parent 242a57b7eb
commit fd4da1b7c4

View file

@ -7,6 +7,7 @@ import android.app.PendingIntent
import android.app.Service import android.app.Service
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.pm.ServiceInfo
import android.os.Build import android.os.Build
import android.os.IBinder import android.os.IBinder
import android.os.PowerManager import android.os.PowerManager
@ -400,7 +401,15 @@ class DownloadService : Service() {
ensureWakeLock() ensureWakeLock()
val notification = buildNotification(0, 0) val notification = buildNotification(0, 0)
startForeground(NOTIFICATION_ID, notification) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(
NOTIFICATION_ID,
notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC,
)
} else {
startForeground(NOTIFICATION_ID, notification)
}
} }
private fun startNativeWorker(requestsJson: String, settingsJson: String) { private fun startNativeWorker(requestsJson: String, settingsJson: String) {