Update manifest, startForeground call

This commit is contained in:
Isira Seneviratne 2025-07-27 11:58:01 +05:30
parent 59db955493
commit b9b47fc520
2 changed files with 11 additions and 8 deletions

View file

@ -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() {