mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-06 21:33:08 +00:00
Use named background task when possible
This commit is contained in:
parent
7467caa879
commit
d9c51e4854
1 changed files with 13 additions and 5 deletions
|
|
@ -629,11 +629,19 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char
|
|||
[[UIApplication sharedApplication] presentLocalNotificationNow:data->notification];
|
||||
|
||||
if (!incallBgTask){
|
||||
incallBgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler: ^{
|
||||
[LinphoneLogger log:LinphoneLoggerWarning format:@"Call cannot ring any more, too late"];
|
||||
[[UIApplication sharedApplication] endBackgroundTask:incallBgTask];
|
||||
incallBgTask=0;
|
||||
}];
|
||||
UIApplication* app = [UIApplication sharedApplication];
|
||||
|
||||
void (^expirationHandler)() = ^{
|
||||
[LinphoneLogger log:LinphoneLoggerWarning format:@"Call cannot ring any more, too late"];
|
||||
[[UIApplication sharedApplication] endBackgroundTask:incallBgTask];
|
||||
incallBgTask=0;
|
||||
};
|
||||
|
||||
if( [app respondsToSelector:@selector(beginBackgroundTaskWithName:expirationHandler:)] ){
|
||||
incallBgTask = [app beginBackgroundTaskWithName:@"Linphone in-call bg task" expirationHandler:expirationHandler];
|
||||
} else {
|
||||
incallBgTask = [app beginBackgroundTaskWithExpirationHandler:expirationHandler];
|
||||
}
|
||||
|
||||
[[NSRunLoop currentRunLoop] addTimer:data->timer forMode:NSRunLoopCommonModes];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue