If we have maps to download, we continue downloading in background.

This commit is contained in:
Kirill Zhdanovich 2013-01-16 18:27:28 +03:00 committed by Alex Zolotarev
parent 5b9c941d98
commit cd534d4b52
2 changed files with 13 additions and 0 deletions

View file

@ -9,6 +9,7 @@
SettingsManager * m_settingsManager;
NSInteger m_standbyCounter;
NSInteger m_activeDownloadsCounter;
UIBackgroundTaskIdentifier m_backgroundTask;
UINavigationController * m_navController;
UIWindow * m_window;
UIAlertView * m_loadingAlertView;

View file

@ -44,6 +44,13 @@ void InitLocalizedStrings()
- (void) applicationDidEnterBackground: (UIApplication *) application
{
[m_mapViewController OnEnterBackground];
if(m_activeDownloadsCounter)
{
m_backgroundTask = [application beginBackgroundTaskWithExpirationHandler:^{
[application endBackgroundTask:m_backgroundTask];
m_backgroundTask = UIBackgroundTaskInvalid;
}];
}
}
- (void) applicationWillEnterForeground: (UIApplication *) application
@ -94,6 +101,11 @@ void InitLocalizedStrings()
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
m_activeDownloadsCounter = 0;
if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground)
{
[[UIApplication sharedApplication] endBackgroundTask:m_backgroundTask];
m_backgroundTask = UIBackgroundTaskInvalid;
}
}
}