Reply To: OpenEars listening while app is in background

Home Forums OpenEars OpenEars listening while app is in background Reply To: OpenEars listening while app is in background

#1015529
ilyashev
Participant

Just to add one, perhaps obvious, point. In order to continue operating the app in the background, and play *multiple* strings via openears, I had to wrap the actions in a background task. I.e.:

– (void) performBGTask
{
UIApplication *application = [UIApplication sharedApplication];

bgTask = [application beginBackgroundTaskWithExpirationHandler:^{
NSLog(@”background operation expiration handler”);
[application endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
}];

[self performSelector:@selector(speakNextPhrase) withObject:nil afterDelay:.25];
// Start the long-running task
}

Otherwise, even with all the audio settings adjusted as suggested above, once the screen was locked the next phrase would not play once the already playing audio ceased.