Q:

Reacting to UserAction in AudioPlayerAgent when app is suspended

I have an audio player that uses BackgroundAudioPlayer together with AudioPlayerAgent.  Everything is working fine, except there's one use case I don't know how to handle. 
If I play an audio track in my application and then the user switches to another application, the audio track continues to play in the background as it should - but I guess my application has now been swapped to memory and is suspended.  
My question is: if the user now starts to play music in another app, I do get the AudioPlayerAgent. UserAction. Stop action as a callback to my AudioAgent.  But can I do anything about this now from my app's point of view?  I mean, I would like to save the position of the audio playback where the user was in my app, but my app has been suspended, right?  
When my app is in the foreground and the audio stops, I do get the BackgroundAudioPlayer. Instance. PlayerState. Stopped event.  It's here that I normally save the position of the playback.  But if the user switches to another app to play music, I don't get this event.  
So I am just wondering how to handle this kind of case.  Is there anything I can do to improve the user experience?  

A:

The only way is to save that Position to Isolated Storage in the agent code. 
See this very useful article of Paul about how to use Background audio agent and the way to communicate between UI and agent side

