summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicoleYarroch <nicole@livio.io>2020-02-17 12:59:31 -0500
committerNicoleYarroch <nicole@livio.io>2020-02-17 12:59:31 -0500
commit2e864ad7d1171adf2b09b55deb1592b69955737e (patch)
tree21c9aefa8467a9debc932cabf1b785f3c92a5794
parentd7efd5eda0d71b6c418689247a146bf4e0901339 (diff)
downloadsdl_ios-bugfix/issue_1544_handle_secondary_transport_socket_errors.tar.gz
-rw-r--r--SmartDeviceLink/SDLBackgroundTaskManager.m5
1 files changed, 5 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLBackgroundTaskManager.m b/SmartDeviceLink/SDLBackgroundTaskManager.m
index 2109a40cd..7adea65e8 100644
--- a/SmartDeviceLink/SDLBackgroundTaskManager.m
+++ b/SmartDeviceLink/SDLBackgroundTaskManager.m
@@ -43,6 +43,11 @@ NS_ASSUME_NONNULL_BEGIN
self.currentBackgroundTaskId = [[UIApplication sharedApplication] beginBackgroundTaskWithName:self.backgroundTaskName expirationHandler:^{
SDLLogD(@"The %@ background task expired", self.backgroundTaskName);
[weakself endBackgroundTask];
+
+ if (UIApplication.sharedApplication.applicationState != UIApplicationStateActive) {
+ SDLLogV(@"App is still in background. Creating a new background task");
+ [weakself startBackgroundTask];
+ }
}];
SDLLogD(@"The %@ background task started with id: %lu", self.backgroundTaskName, (unsigned long)self.currentBackgroundTaskId);