Update manifest, startForeground call

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

View file

@ -96,8 +96,14 @@
android:exported="false" android:exported="false"
android:label="@string/title_activity_about" /> android:label="@string/title_activity_about" />
<service android:name=".local.subscription.services.SubscriptionsImportService" /> <service
<service android:name=".local.subscription.services.SubscriptionsExportService" /> android:name=".local.subscription.services.SubscriptionsImportService"
android:foregroundServiceType="dataSync" />
<service
android:name=".local.subscription.services.SubscriptionsExportService"
android:foregroundServiceType="dataSync" />
<service <service
android:name=".local.feed.service.FeedLoadService" android:name=".local.feed.service.FeedLoadService"
android:foregroundServiceType="dataSync" /> android:foregroundServiceType="dataSync" />
@ -431,6 +437,7 @@
</activity> </activity>
<service <service
android:name=".RouterActivity$FetcherService" android:name=".RouterActivity$FetcherService"
android:foregroundServiceType="dataSync"
android:exported="false" /> android:exported="false" />
<!-- opting out of sending metrics to Google in Android System WebView --> <!-- opting out of sending metrics to Google in Android System WebView -->

View file

@ -174,12 +174,8 @@ public final class NotificationUtil {
} }
updateNotification(); updateNotification();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { ServiceCompat.startForeground(player.getService(), NOTIFICATION_ID,
player.getService().startForeground(NOTIFICATION_ID, notificationBuilder.build(), notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK);
ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK);
} else {
player.getService().startForeground(NOTIFICATION_ID, notificationBuilder.build());
}
} }
public void cancelNotificationAndStopForeground() { public void cancelNotificationAndStopForeground() {