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() { ...@@ -91,9 +91,6 @@ abstract class AbstractFetchDownloadService : Service() {
} }
ACTION_RESUME -> { ACTION_RESUME -> {
NotificationManagerCompat.from(context).cancel(
currentDownloadJobState.foregroundServiceId
)
currentDownloadJobState.status = DownloadJobStatus.ACTIVE currentDownloadJobState.status = DownloadJobStatus.ACTIVE
currentDownloadJobState.job = CoroutineScope(IO).launch { currentDownloadJobState.job = CoroutineScope(IO).launch {
...@@ -102,8 +99,11 @@ abstract class AbstractFetchDownloadService : Service() { ...@@ -102,8 +99,11 @@ abstract class AbstractFetchDownloadService : Service() {
} }
ACTION_CANCEL -> { ACTION_CANCEL -> {
NotificationManagerCompat.from(context).cancel(
currentDownloadJobState.foregroundServiceId
)
currentDownloadJobState.status = DownloadJobStatus.CANCELLED currentDownloadJobState.status = DownloadJobStatus.CANCELLED
stopForeground(true)
currentDownloadJobState.job?.cancel() currentDownloadJobState.job?.cancel()
} }
...@@ -219,8 +219,7 @@ abstract class AbstractFetchDownloadService : Service() { ...@@ -219,8 +219,7 @@ abstract class AbstractFetchDownloadService : Service() {
download download
) )
// We want to startForeground so that the system is less likely to kill our service under memory pressure. NotificationManagerCompat.from(context).notify(
startForeground(
downloadJobs[download.id]?.foregroundServiceId ?: 0, downloadJobs[download.id]?.foregroundServiceId ?: 0,
ongoingDownloadNotification 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