Reputation: 121
I'm trying to use AVAudioSession and AVAudioPlayer and audio background mode to keep my app active in background. It works fine if no interruptions arrives. But, when I received audioPlayerBeginInterruption message I launch a backgroundTask and wait for audioPlayerEndInterruption message, and then relaunch my audio session.
(I noticed that after audioPlayerBeginInterruption apps is still active, player is just paused, but after audioPlayerEndInterruption apps become suspended)
Problem 1 : If the audioPlayerEndInterruption message arrive after 10 minutes, background task is killed and application become suspended, and I Can't restart my audio session
Problem 2 : For several apps/games, I received audioPlayerBeginInterruption message but I never received audioPlayerEndInterruption.
How can I get my application always active ?
Thanks for all your answer and advice
Upvotes: 2
Views: 1018
Reputation: 2043
You aren't going to be able to resume your audio in the background, if the interruption lasts more than ten minutes.
Nor is there a way to force your background audio session active if the foreground app requests an exclusive audio session.
Upvotes: 1