Android targetSdk 34

This commit is contained in:
Emux 2023-12-09 14:00:50 +02:00
parent c6473055f4
commit a3d561e144
No known key found for this signature in database
GPG key ID: 64ED9980896038C3
2 changed files with 10 additions and 1 deletions

View file

@ -4,6 +4,7 @@ import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.pm.ServiceInfo;
import android.os.Build;
import android.util.Log;
@ -169,7 +170,10 @@ public class DownloadWorker extends Worker {
}
notificationBuilder.setContentText("Starting Download");
// Mark the Worker as important
setForegroundAsync(new ForegroundInfo(NOTIFICATION_ID, notificationBuilder.build()));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
setForegroundAsync(new ForegroundInfo(NOTIFICATION_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC));
else
setForegroundAsync(new ForegroundInfo(NOTIFICATION_ID, notificationBuilder.build()));
try {
if (DEBUG) Log.d(LOG_TAG, "Download lookup & profiles");
if (!downloadLookup()) {