One of the first Windows Phone apps I wrote was Pop
Quiz. The app contains the top 40 from the start of the charts in 1952 and
goes up to the end of 2010.
You can answer questions on any decade, and get random questions based on 'Who had a number x hit with yyyy in zzzz', 'In which year was xxxx a number y hit for zzzzz' and 'Which songer was a number x hit for yyyy in zzzz'.
There was also a link to 'Zune' so that when you got an answer, you could browse the artist and music on Zune.
As we all know, Zune has fade from the scene, so that bit of the app was redundant. When I ported it to run on Windows 8, I added some enhancements, like 'Beat The Intro' from your music library, so, like painting the Forth Bridge, I decided to port that back to the Windows Phone Version.
This was done fairly easily, and it was back in the store, but still with Zune non-functioning.
A couple of weeks ago, I was asked to do a presentation on Windows Phone 8 at MoMoMcr, and chair the evening. One of the presenters was my good friend Riaz Ahmed, the developer outreach manager for Nokia. Riaz gave an excellent presentation on Nokia Apps and Developer API's, and talked about the Nokia Music API. For those who haven't used it on the Lumia, it is a great app with hundreds of mixes and millions of tracks on there.
Windows Phone 8 introduced the idea of App-to-App API's, and Nokia Music can take advantage of that, but obviously Windows Phone 7.x can't. There is however a web interface for Windows Phone 7.x and non-Lumia phones. Even better, there is a NuGet packaged called NokiaMusic which takes care of all this for you, making it easier to get up and running quickly.
Steve Robbins, Chief Architect at Nokia Music has a great webinar on using the API, so I settled down to watch it. It explained how to use it, and even I was able to understand it, so I decided to add it to Pop Quiz. I added the reference to my project using NuGet and got down to cutting some code.
I had already decided how to implement. On my original version, I had an application bar button for Zune, so I had decided to rearrange things and dedicate 3 application bar buttons to Nokia Music. The buttons are originally disabled, and only enabled when a question has been answered, right or wrong.
There are several 'tasks' in the Nokia Music API available to developers, but
I decided I was only going to use 3. The options are (my choices in
The code has been written to resemble the built in Launchers and Choosers, and as such, should be familiar to most developers. In PopQuiz, I obviously have an artist for every track, so when the answer has been chosen, I enable the application bar buttons.
As I said earlier, I decided on the options I though were the best fit. So in this case we have an artist of 'The Beach Boys'. To show the artist, the code behind the button is:-
ShowArtistTask task = new ShowArtistTask();
task.ArtistName = webartist;
The API works out for you what to do from this point, depending on your OS
and make of phone. For a Lumia running Windows Phone 8, then the App-To-App
API's come into play.
For a Windows Phone 7.x, or non-Lumia phone, then the web interface is used. The code above generates:-
Similarly, the code for Music Search and Play Mix are:-
PlayMixTask task = new PlayMixTask();
task.ArtistName = webartist;
private void Musicsearch_OnClick(object sender, EventArgs e)
MusicSearchTask task = new MusicSearchTask();
task.SearchTerms = webartist;
and produce the screens:-
There is far more scope in the Nokia Music API's than I have covered here. You can search for gigs in your local area, get charts, new release and more. There are more details here. This is all FREE too.
With very little effort, I feel I have added value to PopQuiz, complementing the app perfectly. Thanks to Steve Robbins from Nokia, who gave me invaluable help in the integration (and fixed the bug I found very quickly :)).
Judge for yourself, PopQuiz is available here, ad-supported, and only 99p to remove the ads. 50,000 + questions - bargain!
Follow me on Twitter
Originally posted 4/Feb/2013