I have a radio player embedded in my Xamarin.iOS app, but when the screen locks the audio stops playing. Per this thread https://forums.xamarin.com/discussion/36651/play-audio-in-background-for-iphone I tried adding this into my AppDelegate's FinishedLaunching method but it didn't work:
var currentSession = AVAudioSession.SharedInstance();
currentSession.SetCategory(AVAudioSessionCategory.Playback, AVAudioSessionCategoryOptions.MixWithOthers);
currentSession.SetActive(true);
AVAudioSessionCategory.Playback plays audio even if the phone is in silent mode. (This works). AVAudioSessionCategoryOptions.MixWithOthers allows to play multiple sounds simultaneously from several apps. (I haven't tested this but it's not relevant to my issue).
currentSession.SetActive(true) should be allowing audio in the background while the screen is locked but it doesn't work.
Any ideas?