From b9b47fc5203a6b2cb08bb70ba51b3eb368ea579e Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Sun, 27 Jul 2025 11:58:01 +0530 Subject: [PATCH] Update manifest, startForeground call --- app/src/main/AndroidManifest.xml | 11 +++++++++-- .../newpipe/player/notification/NotificationUtil.java | 8 ++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index efb667b22..8a6b22ab3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -96,8 +96,14 @@ android:exported="false" android:label="@string/title_activity_about" /> - - + + + + @@ -431,6 +437,7 @@ diff --git a/app/src/main/java/org/schabi/newpipe/player/notification/NotificationUtil.java b/app/src/main/java/org/schabi/newpipe/player/notification/NotificationUtil.java index 30420b0c7..e5e2544b2 100644 --- a/app/src/main/java/org/schabi/newpipe/player/notification/NotificationUtil.java +++ b/app/src/main/java/org/schabi/newpipe/player/notification/NotificationUtil.java @@ -174,12 +174,8 @@ public final class NotificationUtil { } updateNotification(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - player.getService().startForeground(NOTIFICATION_ID, notificationBuilder.build(), - ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK); - } else { - player.getService().startForeground(NOTIFICATION_ID, notificationBuilder.build()); - } + ServiceCompat.startForeground(player.getService(), NOTIFICATION_ID, + notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK); } public void cancelNotificationAndStopForeground() {