Skip to content

Commit 59db955

Browse files
Fix new streams notification issue
1 parent 22a709d commit 59db955

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,15 @@
9898

9999
<service android:name=".local.subscription.services.SubscriptionsImportService" />
100100
<service android:name=".local.subscription.services.SubscriptionsExportService" />
101-
<service android:name=".local.feed.service.FeedLoadService"
101+
<service
102+
android:name=".local.feed.service.FeedLoadService"
102103
android:foregroundServiceType="dataSync" />
103104

105+
<service
106+
android:name="androidx.work.impl.foreground.SystemForegroundService"
107+
android:foregroundServiceType="dataSync"
108+
tools:node="merge" />
109+
104110
<activity
105111
android:name=".PanicResponderActivity"
106112
android:exported="true"

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.schabi.newpipe.local.feed.notifications
22

33
import android.content.Context
4+
import android.content.pm.ServiceInfo
5+
import android.os.Build
46
import android.util.Log
57
import androidx.core.app.NotificationCompat
68
import androidx.work.Constraints
@@ -83,7 +85,8 @@ 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+
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))
8790
}
8891

8992
companion object {

0 commit comments

Comments
 (0)