Hi All,
I have enabled one of the Background mode setting(Audio, Airplay and Picture in Picture) in Info.plist. i am getting red bar at top of Iphone home screen as soon as my app goes to background. please find the attached screenshot. Is it possible to hide that red bar in xamarin.IOS.
Answers
The red bar shows up if the app go to background while audio is playing .
To hide it you need to stop the audio before entering background , you can do it in method
DidEnterBackground
in AppDelegate .Refer to https://stackoverflow.com/a/11451024/8187800.
Xamarin forums are migrating to a new home on Microsoft Q&A!
We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
For more information, please refer to this sticky post.
Hi colex,
i have tried to stop the audio in DidEnterBackground method but still i am able to see red bar.
Is your app doing other things(e.g recording screen) at that time ?
If so , stop them all .
Hi colex,
Yes, but i am stoping in didEnterbackground event but it is not stoping. i have tried stoping the audio any click event in app, it is working fine.
Can you post the code in
didEnterbackground
? How you stop the audio ?var currentSession = AVAudioSession.SharedInstance();
currentSession.SetCategory(AVAudioSessionCategory.Playback, AVAudioSessionCategoryOptions.MixWithOthers);
currentSession.SetActive(false);
From iOS 13, we need to override the lifecycle method in SceneDelegate , check details in https://stackoverflow.com/questions/56508764/app-delegate-methods-arent-being-called-in-ios-13 .
So move your code into the
DidEnterBackground
method inSceneDelegate
.@mahipalReddyNareddy Have you solved the problem ?