Skip to content

Commit 720c39e

Browse files
Suppress NewApi
1 parent b9b47fc commit 720c39e

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

app/src/main/java/org/schabi/newpipe/local/feed/notifications/NotificationWorker.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ class NotificationWorker(
8585
.setPriority(NotificationCompat.PRIORITY_LOW)
8686
.setContentTitle(applicationContext.getString(R.string.feed_notification_loading))
8787
.build()
88-
val serviceType = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC else 0
89-
setForegroundAsync(ForegroundInfo(FeedLoadService.NOTIFICATION_ID, notification, serviceType))
88+
@Suppress("NewApi") // ServiceInfo constant is inlined
89+
setForegroundAsync(ForegroundInfo(FeedLoadService.NOTIFICATION_ID, notification,
90+
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC))
9091
}
9192

9293
companion object {

app/src/main/java/org/schabi/newpipe/player/notification/NotificationUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public boolean shouldUpdateBufferingSlot() {
167167
&& notificationBuilder.mActions.get(2).actionIntent != null);
168168
}
169169

170-
170+
@SuppressLint("NewApi") // ServiceInfo constant is inlined
171171
public void createNotificationAndStartForeground() {
172172
if (notificationBuilder == null) {
173173
notificationBuilder = createNotification();

0 commit comments

Comments
 (0)