How to check whether music already running in windows phone or not when you are trying to play music from your app?

 

Dear Friends,

Once your app is complete and  you have some background music you try to run it on simulator and you think everything working.

When you submit the app in app store you get error test case  6.5 failed.

Which Says

When the user is already playing music on the phone when the app is launched, the app must not pause, resume, or stop the active music in the phone”

So next question arises how to pass this test. so its fairly simple

Just follow below steps assuming that your page has a media player control with name  mplayer.

Step 1:- Add reference of Microsoft.Xna.Framework & Microsoft.Xna.Framework.Media on your page

Step 2: You need to write following line

   1: FrameworkDispatcher.Update();

   2:  

   3: f(MediaPlayer.GameHasControl)

   4: mplayer.play()}else if(MessageBox.Show("Isitoktostopcurrentlyplayingmusicandplaychant?")==MessageBoxResult.OK)

   5:  

   6:  

   7: player.play();}

Now your issue is resolved.

to test this just play music in your app then run your app. It will give you popup. which we wrote above.

I hope you can submit your app now.

Thanks

Rajat Jaiswal

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s