flammenwerfert running notification again

This commit is contained in:
LuftVerbot 2023-06-04 13:39:54 +02:00
parent ce37320e1e
commit f83c4ea8df

View file

@ -4,6 +4,7 @@ import android.app.Notification
import android.app.Service
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.IBinder
import android.os.PowerManager
import androidx.annotation.StringRes
@ -89,11 +90,14 @@ class AnimeDownloadService : Service() {
override fun onCreate() {
scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
downloadManager.queue.state.value.forEach {
startForeground(it.episode.id.hashCode(), getPlaceholderNotification())
}
wakeLock = acquireWakeLock(javaClass.name)
_isRunning.value = true
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForeground(1, getPlaceholderNotification())
} else {
@Suppress("DEPRECATION")
startForeground(1, Notification())
}
listenNetworkChanges()
}