One of my apps have recently failed certification because: "my app stops background music without asking user when it wants to play some music".
Now the question is: how can we detect if there is any music playing in the background?
Regards
One of my apps have recently failed certification because: "my app stops background music without asking user when it wants to play some music".
Now the question is: how can we detect if there is any music playing in the background?
Regards
You need to examine the MediaPlayer.GameHasControl property.
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.media.mediaplayer.gamehascontrol.aspx
MediaPlayer.State will be Playing even if you're playing the music. GameHasControl determines if the music was started from your app, or if another app was playing before your app started.
You can get the value in OnActivated...
And use that value throughout your game to determine whether or not you should play music.
...