Subscribe to the RSS feed then follow me on twitter at @mrlacey

Friday, August 26, 2011

Improvements in Music & Video hub integration #wp7dev

Back in January I wrote about some of the Gotchas when integrating with the Music and Video Hub.
With the latest/mango update to Windows Phone 7 there are a couple of changes/improvements to note.

MediaHistoryItem.Source

This is property still exists and is still not used for anything but it no longer needs to be set. (Even thought the examples on MSDN still show it being set.)


ImageStream / MaxImageSize

Previously this was a tiny 16kb and it made it impossible to show high quality images (of album artwork or packshots) at 358x358 (or 173x173) pixels.
Good news!
This has been dramatically increased to a much more practical 75kb.

Disappointingly this still isn't clearly documented in MSDN and the page on How to: Integrate with the Music and Videos Hub for Windows Phone (only lists the physical image dimensions, not the size on disk) and we have to rely on an exception to know what the limit is:


Also disappointingly, that page doesn't allow for community content. :(
I'm sure there's a good reason that not every page supports community content but it would be nice if they did because I'd add some useful information there is I could. I suspect more people would read that there than this here.

If you've built Windows Phone or Windows Store apps you can cross-promote them with AdDuplex to get more users.

Wednesday, August 24, 2011

#wp7dev NoDo Tools won't deploy to Pre-Mango phone after Zune upgrade to 4.8

This morning I had an issue where after updating the desktop Zune software to the new version (4.8) Visual Studio (running the NoDo development tools*) became unable to deploy or debug apps running on a phone. This was the case with a phone running a Nodo version (specifically 7.0.7392) and another phone running a pre-NoDo build.

Obviously, losing the ability to deploy to and test on an actual device was of concern. After a few worried minutes involving restarting the software (Zune & Visual Studio) and rebooting the phone we resolved this issue by rebooting the PC. Panic over.

Hopefully knowing that a reboot may be required may save someone else a bit of time.


* I have a separate machine running the Mango SDK RC which wasn't affected.

If you've built Windows Phone or Windows Store apps you can cross-promote them with AdDuplex to get more users.

Sunday, August 14, 2011

Catching an uncatchable exception

Recently we had an interesting issue in a Windows Phone 7 app I was working on that proved awkward to address. The code in question related to playing a video via the MediaPlayerLauncher.

The code in question looked like this:
                    new MediaPlayerLauncher { Media = fileUri }
                        .Show();
The issue we had was that if the user triggered the launching of the MediaPlayer and then very quickly hit the back button then they could get the following error.

"Not allowed to call Show() when a navigation is in progress"

As a first we tried wrapping the above code in a simple try..catch block to handle the unhandled exception:
                try
                {
                    new MediaPlayerLauncher { Media = fileUri }
                        .Show();
                }
                catch (Exception exc)
                {
                    ...
                }
But this didn't work.

Next we tried to determine if navigation was in progress by comparing the CurrentSource and Source properties of the page but that didn't work either.

Then I had an idea.
What if we split the separated the generation of the object and the calling of the method?:
                        var mediaLauncher = new MediaPlayerLauncher();
                        mediaLauncher.Media = fileUri;

                        try
                        {
                            mediaLauncher.Show();
                        }
                        catch (InvalidOperationException exc)
                        {
                            ...
                        }
This did allow us to catch and handle the exception. Yay!

I'm a big fan of not writing any code I don't have to and so having to write more than I think should be absolutely necessary here is a little bit disappointing. It's good to know, however that this isn't an exception I can't do anything about.
In this situation I can happily ignore this exception as if the user has hit back shortly after trying to lauch the video it's reasonable to assume they don't actually want to watch it.

If you've built Windows Phone or Windows Store apps you can cross-promote them with AdDuplex to get more users.

Microsoft and me. A disclaimer

If you didn't know, I'm a freelance developer. If you're looking for someone to do some mobile development, particularly on Windows Phone 7, then please get in touch.

Recently I've been doing some work for Microsoft. They're keen that I make it clear that anything I say on this blog, or via my Twitter account (@mrlacey) is entirely my own thought, opinion, etc.
Nothing I say here is the opinions of anyone but myself.

As far as I am concerned there is no conflict of interest with my continuing to run the Windows Phone User Group and do a short term contract with Microsoft. The group continues to remain an independent group. If you have any concerns over this then please let me know.

If you've built Windows Phone or Windows Store apps you can cross-promote them with AdDuplex to get more users.

Wednesday, August 03, 2011

Getting version numbers and names right is hard

Rant alert! You have been warned!

Managing platform & SDK version names and numbers can be hard. When you want a simplified, public name for these that can be used in marketing and promotion things can easily get confusing.

Let's consider Windows Phone:

Once upon a time there was "Pocket PC"
Then there was "Smartphone" - before it became a generic term.
This was followed by "Windows Mobile"
When "Windows Mobile" (the OS) reached version 6.X it was marketed to the public as being "Windows Phone"
Then Microsoft announced "Windows Phone 7 Series"
This was quickly rebranded "Windows Phone 7"
This first major update to this was codenamed "mango"
When beta versions of the "mango" tool were made available to developers they were versioned as 7.1.
It's been reported that, when it's officially released, what has previously been "codenamed mango" will be version 7.5 and the platform as a whole will be referred to as simply "Windows Phone"

We're now in the position where names are being reused and there are multiple names and version numbers for the same thing. :(

If this wasn't potentially confusing enough some (hopefully well meaning) people have started retagging blogs, tweets, questions, etc. with their own personal preference for the name and sometimes version number.

In a folksonomy it's "folkS" plural!
If you're a single person, with limited, demonstrated, knowledge and experience of anything and you want to start changing what things are called (especially if it's something I care about) please don't. It doesn't make you clever or important and you coudl end up doing more harm than good.
It's also a waste of time to manually retag things when ways to create aliases exist.

Blindly changing things without addressing the reasons why they need changing or informing the people who are continuing to create items with the "older" tag just compounds problems and confusion.

Grrr

If you've built Windows Phone or Windows Store apps you can cross-promote them with AdDuplex to get more users.