Merge pull request #649 from devemux86/targetSdk34

Android targetSdk 34
This commit is contained in:
afischerdev 2024-01-15 18:18:08 +01:00 committed by GitHub
commit a3ae1ce5e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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()) {