mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -21,6 +21,7 @@ import kotlin.coroutines.CoroutineContext
|
||||
abstract class BaseService : LifecycleService() {
|
||||
|
||||
private val simpleName = this::class.simpleName.toString()
|
||||
private var isForeground = false
|
||||
|
||||
fun <T> execute(
|
||||
scope: CoroutineScope = lifecycleScope,
|
||||
@@ -42,7 +43,10 @@ abstract class BaseService : LifecycleService() {
|
||||
LogUtils.d(simpleName) {
|
||||
"onStartCommand $intent ${intent?.toUri(0)}"
|
||||
}
|
||||
startForegroundNotification()
|
||||
if (!isForeground) {
|
||||
startForegroundNotification()
|
||||
isForeground = true
|
||||
}
|
||||
return super.onStartCommand(intent, flags, startId)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user