File tree Expand file tree Collapse file tree 3 files changed +26
-11
lines changed Expand file tree Collapse file tree 3 files changed +26
-11
lines changed Original file line number Diff line number Diff line change 9696 android : exported =" false"
9797 android : label =" @string/title_activity_about" />
9898
99- <service android : name =" .local.subscription.services.SubscriptionsImportService" />
100- <service android : name =" .local.subscription.services.SubscriptionsExportService" />
101- <service android : name =" .local.feed.service.FeedLoadService"
99+ <service
100+ android : name =" .local.subscription.services.SubscriptionsImportService"
102101 android : foregroundServiceType =" dataSync" />
103102
103+ <service
104+ android : name =" .local.subscription.services.SubscriptionsExportService"
105+ android : foregroundServiceType =" dataSync" />
106+
107+ <service
108+ android : name =" .local.feed.service.FeedLoadService"
109+ android : foregroundServiceType =" dataSync" />
110+
111+ <service
112+ android : name =" androidx.work.impl.foreground.SystemForegroundService"
113+ android : foregroundServiceType =" dataSync"
114+ tools : node =" merge" />
115+
104116 <activity
105117 android : name =" .PanicResponderActivity"
106118 android : exported =" true"
425437 </activity >
426438 <service
427439 android : name =" .RouterActivity$FetcherService"
440+ android : foregroundServiceType =" dataSync"
428441 android : exported =" false" />
429442
430443 <!-- opting out of sending metrics to Google in Android System WebView -->
Original file line number Diff line number Diff line change 11package org.schabi.newpipe.local.feed.notifications
22
33import android.content.Context
4+ import android.content.pm.ServiceInfo
5+ import android.os.Build
46import android.util.Log
57import androidx.core.app.NotificationCompat
68import androidx.work.Constraints
@@ -83,7 +85,9 @@ class NotificationWorker(
8385 .setPriority(NotificationCompat .PRIORITY_LOW )
8486 .setContentTitle(applicationContext.getString(R .string.feed_notification_loading))
8587 .build()
86- setForegroundAsync(ForegroundInfo (FeedLoadService .NOTIFICATION_ID , notification))
88+ // ServiceInfo constants are not used below Android Q, so 0 is set here
89+ val serviceType = if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .Q ) ServiceInfo .FOREGROUND_SERVICE_TYPE_DATA_SYNC else 0
90+ setForegroundAsync(ForegroundInfo (FeedLoadService .NOTIFICATION_ID , notification, serviceType))
8791 }
8892
8993 companion object {
Original file line number Diff line number Diff line change @@ -167,19 +167,17 @@ public boolean shouldUpdateBufferingSlot() {
167167 && notificationBuilder .mActions .get (2 ).actionIntent != null );
168168 }
169169
170-
171170 public void createNotificationAndStartForeground () {
172171 if (notificationBuilder == null ) {
173172 notificationBuilder = createNotification ();
174173 }
175174 updateNotification ();
176175
177- if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .Q ) {
178- player .getService ().startForeground (NOTIFICATION_ID , notificationBuilder .build (),
179- ServiceInfo .FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK );
180- } else {
181- player .getService ().startForeground (NOTIFICATION_ID , notificationBuilder .build ());
182- }
176+ // ServiceInfo constants are not used below Android Q, so 0 is set here
177+ final int serviceType = Build .VERSION .SDK_INT >= Build .VERSION_CODES .Q
178+ ? ServiceInfo .FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK : 0 ;
179+ ServiceCompat .startForeground (player .getService (), NOTIFICATION_ID ,
180+ notificationBuilder .build (), serviceType );
183181 }
184182
185183 public void cancelNotificationAndStopForeground () {
You can’t perform that action at this time.
0 commit comments