Commit 2e07ea32 authored by Sawyer Blatz's avatar Sawyer Blatz
Browse files

Fixes #4908: Use notify instead of startForeground

parent 6f38790d
......@@ -91,9 +91,6 @@ abstract class AbstractFetchDownloadService : Service() {
}
ACTION_RESUME -> {
NotificationManagerCompat.from(context).cancel(
currentDownloadJobState.foregroundServiceId
)
currentDownloadJobState.status = DownloadJobStatus.ACTIVE
currentDownloadJobState.job = CoroutineScope(IO).launch {
......@@ -102,8 +99,11 @@ abstract class AbstractFetchDownloadService : Service() {
}
ACTION_CANCEL -> {
NotificationManagerCompat.from(context).cancel(
currentDownloadJobState.foregroundServiceId
)
currentDownloadJobState.status = DownloadJobStatus.CANCELLED
stopForeground(true)
currentDownloadJobState.job?.cancel()
}
......@@ -219,8 +219,7 @@ abstract class AbstractFetchDownloadService : Service() {
download
)
// We want to startForeground so that the system is less likely to kill our service under memory pressure.
startForeground(
NotificationManagerCompat.from(context).notify(
downloadJobs[download.id]?.foregroundServiceId ?: 0,
ongoingDownloadNotification
)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment