Search code examples
c#windows-phone-7windows-phone-8lockscreen

Updating LockScreen Background


How to update the lockscreen image from the isolated storage when the phone is playing music["show artist when playing music" is turned on in the lockscreen settings].?

It throws an exception

System.Exception: The requested resource is in use. (Exception from HRESULT: 0x800700AA) at Windows.Phone.System.UserProfile.LockScreen.SetImageUri(Uri value)

Or is there any way to find whether the phone is playing music or not??


Solution

  • I'm pretty sure that you can, there should be a property called State or something similar in the class that manage the device audio.

    In XNA there's the property

    Microsoft.Xna.Framework.Media.MediaPlayer.State == MediaState.Playing
    

    you should have something like this.

    Or try with MediaPlayer.GameHasControl