Skip to content
This repository was archived by the owner on Dec 18, 2022. It is now read-only.

Commit a544c73

Browse files
committed
bug fix: resolves #84
1 parent eaf4f4c commit a544c73

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

topl-service/src/main/java/io/matthewnelson/topl_service/lifecycle/BackgroundManager.kt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,16 @@ class BackgroundManager internal constructor(
320320
private fun applicationMovedToBackground() {
321321
taskIsInForeground = false
322322
if (!ServiceActionProcessor.wasLastAcceptedServiceActionStop()) {
323-
// System automatically unbinds when app is sent to the background. This prevents
324-
// it so that we maintain a started, bound service.
325-
BaseService.bindService(
326-
BaseService.getAppContext(),
327-
serviceClass,
328-
bindServiceFlag = bindServiceFlag
329-
)
330-
TorServiceConnection.serviceBinder?.executeBackgroundPolicyJob(policy, executionDelay)
323+
TorServiceConnection.serviceBinder?.let { binder ->
324+
// System automatically unbinds when app is sent to the background. This prevents
325+
// it so that we maintain a started, bound service.
326+
BaseService.bindService(
327+
BaseService.getAppContext(),
328+
serviceClass,
329+
bindServiceFlag = bindServiceFlag
330+
)
331+
binder.executeBackgroundPolicyJob(policy, executionDelay)
332+
}
331333
}
332334
}
333335
}

0 commit comments

Comments
 (0)