1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-09-04 20:07:56 +00:00

Suppress NewApi

This commit is contained in:
Isira Seneviratne
2025-07-27 12:17:44 +05:30
parent b9b47fc520
commit fece0741e5
2 changed files with 3 additions and 3 deletions

View File

@@ -2,7 +2,6 @@ package org.schabi.newpipe.local.feed.notifications
import android.content.Context
import android.content.pm.ServiceInfo
import android.os.Build
import android.util.Log
import androidx.core.app.NotificationCompat
import androidx.work.Constraints
@@ -85,7 +84,8 @@ class NotificationWorker(
.setPriority(NotificationCompat.PRIORITY_LOW)
.setContentTitle(applicationContext.getString(R.string.feed_notification_loading))
.build()
val serviceType = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC else 0
@Suppress("NewApi") // ServiceInfo constant is inlined
val serviceType = ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
setForegroundAsync(ForegroundInfo(FeedLoadService.NOTIFICATION_ID, notification, serviceType))
}

View File

@@ -167,7 +167,7 @@ public final class NotificationUtil {
&& notificationBuilder.mActions.get(2).actionIntent != null);
}
@SuppressLint("NewApi") // ServiceInfo constant is inlined
public void createNotificationAndStartForeground() {
if (notificationBuilder == null) {
notificationBuilder = createNotification();