Should fix missing incoming call notification caused by Service started before app
This commit is contained in:
parent
04e8c3566b
commit
7c267dad25
2 changed files with 11 additions and 1 deletions
|
@ -46,8 +46,12 @@ class CoreService : CoreService() {
|
||||||
coreContext.notificationsManager.startForeground(this, true)
|
coreContext.notificationsManager.startForeground(this, true)
|
||||||
}
|
}
|
||||||
coreContext.checkIfForegroundServiceNotificationCanBeRemovedAfterDelay(5000)
|
coreContext.checkIfForegroundServiceNotificationCanBeRemovedAfterDelay(5000)
|
||||||
|
} else {
|
||||||
|
ensureCoreExists(applicationContext, pushReceived = false, service = this, useAutoStartDescription = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
coreContext.notificationsManager.serviceCreated(this)
|
||||||
|
|
||||||
return super.onStartCommand(intent, flags, startId)
|
return super.onStartCommand(intent, flags, startId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +77,7 @@ class CoreService : CoreService() {
|
||||||
Log.i("[Service] Task removed, stopping Core")
|
Log.i("[Service] Task removed, stopping Core")
|
||||||
coreContext.stop()
|
coreContext.stop()
|
||||||
} else {
|
} else {
|
||||||
Log.w("[Service] Task removed but Core in not in background, skipping")
|
Log.w("[Service] Task removed but Core is not in background, skipping")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.i("[Service] Task removed but we were asked to keep the service alive, so doing nothing")
|
Log.i("[Service] Task removed but we were asked to keep the service alive, so doing nothing")
|
||||||
|
|
|
@ -411,7 +411,13 @@ class NotificationsManager(private val context: Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun serviceCreated(createdService: CoreService) {
|
||||||
|
Log.i("[Notifications Manager] Service has been created, keeping it around")
|
||||||
|
service = createdService
|
||||||
|
}
|
||||||
|
|
||||||
fun serviceDestroyed() {
|
fun serviceDestroyed() {
|
||||||
|
Log.i("[Notifications Manager] Service has been destroyed")
|
||||||
stopForegroundNotification()
|
stopForegroundNotification()
|
||||||
service = null
|
service = null
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue