title: How to ensure that a Xamarin Forms app (AVAudioSessionCategoryPlayback mode) is suspended correctly by iOS to prevent battery drain?
body: <p>I have a Xamarin Forms app running in AVAudioSessionCategory = Playback mode and it works very nice, background audio is playing and even my timers keep running in the background, which is fine during playback.</p>
  <p>How can I ensure that after a user has decided to stop playing audio (either by pressing a button inside of the app or by pressing the pause button on the lock screen) my app will go into a Suspended state and it won't drain the battery?</p>
  <p>Is there a way to either force my app to go suspended or a way to verify whether it has?</p>
  <p>As a side-note: Hooking the OnSleep method in App.xaml.cs is NOT sufficient because it is being called every time the app goes to the background even if it's playing audio, my timers are running, HTTP calls working, etc.</p>
  <p><strong>UPDATE</strong>:</p>
  <p>Made an interesting discovery today:</p>
  <ul>
  <li>Timers keep running running in the background when the app is started from Visual Studio in debug mode (over WiFi).</li>
  <li>Timers seem to get suspended automatically by the OS (iOS) when the app enters background in Release mode.</li>
  </ul>
  <p>My conclusion is: maybe the entire problem lies somewhere in the 'framework' that is added to the app by Xamarin to ensure communication between Visual Studio and the app? (Console, breakpoints, etc.) It would be a logical explanation.</p>