diff options
author | NicoleYarroch <nicole@livio.io> | 2020-02-17 12:59:31 -0500 |
---|---|---|
committer | NicoleYarroch <nicole@livio.io> | 2020-02-17 12:59:31 -0500 |
commit | 2e864ad7d1171adf2b09b55deb1592b69955737e (patch) | |
tree | 21c9aefa8467a9debc932cabf1b785f3c92a5794 | |
parent | d7efd5eda0d71b6c418689247a146bf4e0901339 (diff) | |
download | sdl_ios-bugfix/issue_1544_handle_secondary_transport_socket_errors.tar.gz |
Restarting expired background taskbugfix/issue_1544_handle_secondary_transport_socket_errors
-rw-r--r-- | SmartDeviceLink/SDLBackgroundTaskManager.m | 5 |
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); |