Fix startForeground for DownloadService
This commit is contained in:
@@ -24,7 +24,7 @@ class ForegroundNotificationSwitcher(
|
||||
@Synchronized
|
||||
fun notify(startId: Int, notification: Notification) {
|
||||
if (notifications.isEmpty()) {
|
||||
StartForegroundRunnable(startId, notification)
|
||||
service.startForeground(startId, notification)
|
||||
} else {
|
||||
notificationManager.notify(startId, notification)
|
||||
}
|
||||
@@ -46,16 +46,6 @@ class ForegroundNotificationSwitcher(
|
||||
handler.postDelayed(NotifyRunnable(startId, notification), DEFAULT_DELAY)
|
||||
}
|
||||
|
||||
private inner class StartForegroundRunnable(
|
||||
private val startId: Int,
|
||||
private val notification: Notification,
|
||||
) : Runnable {
|
||||
|
||||
override fun run() {
|
||||
service.startForeground(startId, notification)
|
||||
}
|
||||
}
|
||||
|
||||
private inner class NotifyRunnable(
|
||||
private val startId: Int,
|
||||
private val notification: Notification?,
|
||||
|
||||
Reference in New Issue
Block a user