when we receive a SensitiveTaskEvents.TaskStarted we call beingLongLivedTask
when we receive a SensitiveTaskEvents.TaskEnded we call endLongLivedTask
Each call uses a unique identifier that is extracted from the parameters in TaskStarted/TaskEnded. So if these events are broadcast multiple times, the system can easily ignore them.
In addition, iOS will "punish" our app if we abuse the longLivedTask system. That is, if we always ask for background execution time. Which would happen if the lightning-kmp library didn't always emit a TaskEnded in every situation. So to protect against this we've also added a backup call to endLongLivedTask that will be executed automatically after a timeout.
This updated architecture is now also used for payments, which are driven by the PeerEvent's: PaymentProgress, PaymentSent, PaymentNotSent.
This integrates the keep-alive mechanism from lightning-kmp #550.
SensitiveTaskEvents.TaskStarted
we callbeingLongLivedTask
SensitiveTaskEvents.TaskEnded
we callendLongLivedTask
Each call uses a unique identifier that is extracted from the parameters in
TaskStarted
/TaskEnded
. So if these events are broadcast multiple times, the system can easily ignore them.In addition, iOS will "punish" our app if we abuse the longLivedTask system. That is, if we always ask for background execution time. Which would happen if the lightning-kmp library didn't always emit a
TaskEnded
in every situation. So to protect against this we've also added a backup call toendLongLivedTask
that will be executed automatically after a timeout.This updated architecture is now also used for payments, which are driven by the PeerEvent's:
PaymentProgress
,PaymentSent
,PaymentNotSent
.