Re-examining WP7 Launchers and Choosers

One of the questions every developer must face when a new technology like WP7 comes on the scene is whether to jump onboard early (in the CTP and Beta stages) or wait until a platform RTMs.  The advantage of the former is that one has a longer lead time to learn the technology and establish oneself as an authority on the technology inside one’s company or on the web.  The advantage of the latter is that one doesn’t waste time learning things about the technology that are in flux and may go away; instead one can wait for the experts to say what they have to say and learn from that.

A possible advantage to deferring the groking of a new technology is that one also has less to unlearn.  Early adopters often make the mistake of assuming that they do not have to re-examine what they already know when the technology RTMs.  The problem for those who defer learning new technologies is that, if they are not careful, they may inherit the bad information disseminated by those early adopters and insiders, and suddenly we are all stuck in a situation where what counts as common knowledge is simply wrong.

Probably the worst case of this for Windows Phone developers occurred with launchers and choosers.  The original metaphor seemed clear enough: launchers are fire-and-forget components, choosers return information.  This turns out not to be completely true, however.  Save operations, which are considered launchers, must return information about whether each save was successful.  They aren’t really fire-and-forget. 

Another early lesson WP7 developers learned was that all launchers and choosers cause an application to tombstone – and thus was created one of the most obscure and difficult aspects of Windows Phone development.  As WP7 went from Beta to RTM, however, it was decided that this didn’t always make sense.  Recovering from tombstoning is time-consuming.  Why force an app to tombstone for something like the CameraCaptureTask when the user will most likely return to the application immediately after the task is completed?  To find out more about deferred tombstoning, see Why Deactivated is Not the Same as Tombstoning.

Just to make things a little more complicated, it isn’t just the four choosers which turn out to not force tombstoning.  MediaPlayerLauncher, one of the eleven launchers, also implements deferred tombstoning.  The PhoneCallTask also does not throw an application into tombstoning mode (additionally, it also never seems to trigger the Deactivated event).  Incoming phone calls, outgoing phone calls, the five choosers and MediaPlayerLauncher all merely suspend (or pause) the application, keeping all the pages along with their state in memory.

If you are confused, welcome to the club.  The original metaphor of having launchers and choosers broke down bit by bit through subsequent iterations of the Windows Phone platform.  Experts quote each other based on these different iterations.  After a while, no one is sure anymore exactly how launchers and choosers work.

The solution, naturally, is to trust but verify everything you read.  You can find out whether an application is actually tombstoned when a task (the generic name for both launchers and choosers) is initiated by placing a simple debug message in the constructor of the page that launches the task.  If the constructor is called when you press back from the task, then your application was tombstoned.  If the constructor is not called, then you know the page has been retained in memory and tombstoning did not occur.

Once you have verified something like this, always write it down somewhere.  Here’s the chart I keep for myself to help remember the behavior of various launchers and choosers.  It is for the RTM version of Windows Phone only.  Please take it with a grain of salt.

Task

Launcher

Chooser

Returns Data

Defers Tombstoning

Suspends Application

CameraCaptureTask

 

X

X

X

X

EmailAddressChooserTask

 

X

X

X

X

EmailComposeTask

X

       

MarketplaceDetailTask

X

       

MarketplaceHubTask

X

       

MarketplaceReviewTask

X

       

MarketplaceSearchTask

X

       

MediaPlayerLauncher

X

   

X

X

PhoneCallTask

X

     

X

PhoneNumberChooserTask

 

X

X

X

X

PhotoChooserTask

 

X

X

X

X

SaveEmailAddressTask

X

 

X

   

SavePhoneNumberTask

   

X

   

SearchTask

X

       

SmsComposeTask

X

       

WebBrowserTask

X

       

I’m joining Razorfish

I am now an employee of a digital powerhouse called Razorfish.  I’m very excited about this.  Whereas before I wrote applications, I am now writing “experiences” – which is a hipster way of saying that I get to apply all of my experience writing LOB applications in WPF and Silverlight to making cool UX (my private vice is now my fulltime job).

I’m actually working for a team within Razorfish called the Emerging Experiences Group which does cutting edge development with Microsoft Surface, Windows Phone, augmented reality and other neat toys.  If you have seen the recent WP7 launch (or happened to be in Barcelona when the phone was announced) you will have noticed the EE’s work even if you didn’t know who they are – EE wrote the “BAP”: the giant windows phone display used to demonstrate how Windows Phone works back when there were very few devices to hand out to people.

My first incredibly cool week as a Presentation Layer Architect in the Emerging Experiences Group was taken up with helping to build an application experience to be debuted at the 2010 Wired Store: http://www.wired.com/about/2010/11/wired-brings-the-best-of-what%E2%80%99s-next-to-new-york-city-experiential-gallery-open-for-the-holidays-in-noho-shopping-district/ 

You can check out more work by Razorfish’s Emerging Experiences Group here: http://emergingexperiences.com/portfolio/

Anonymity, Identity and my XBox gamer tag

squarepeg

This a postmodern title for a silly problem.  I am trying to consolidate my XBox gamer tag, my Zune Pass tag, and the different Windows Live IDs I use for these tags with the Live ID I use for my Windows Phone 7 and my WP7 marketplace account.  After half an hour on the phone with XBox support, I’m not sure if I’ve gotten any closer to pulling myself together.

The nature of online identities has changed over the past several years.  It used to be that it was a great idea to use anonymous handles online.  The persona one used online to criticize Apple or Microsoft or the US government could hypothetically never be traced back to the real you.  It was even a good idea to have multiple anonymous online handles.  One would use various bogus email accounts to track junk mail, other ones to deal with the mortgage, another one to deal with the bank. 

I was the circus master to an army of anonymous online daemons sent out to do my virtual bidding.

But things changed.  It turns out that the web isn’t just a place to make a nuisance of oneself; it is also a place to garner and horde rewards.  Tying the handle I use to make Amazon book recommendations with the one I use on MSDN forums with the one I use on my blog suddenly started seeming like a great idea, and so three years ago or so I started using my real name for everything.  This was a matter of vanity, of course.

More recently, it has become a matter of necessity.  I have about ten different Live IDs and I am trying to consolidate them all with my open id, facebook account, Blogger account, twitter account, etc.  Microsoft has started tying the Zune Pass to Windows Phone and XBox.  This is all great stuff – but only if all the IDs for these various services are consolidated.

When I got my Zune Pass, I was required to create a Zune tag and associate it with a Live ID.  My XBox gold membership is also associated with a Live ID and gamer tag.  Unfortunately, these are different IDs.  Zune will let me switch gamer tags, but only if the one I want to switch to doesn’t already exist.  XBox will let me associate my gamer tag with a different Live ID, but only if that Live ID doesn’t have a different gamer tag associated with it

Just to make things a little clearer, I’ll provide some names.  My XBox tag is DHTMLKing (I thought that particular Microsoft technology would take off back in the day) tied to my Live ID hotsweats@hotmail.com (a long story).  My Zune Pass moniker is fightclubber3xY tied to my Live ID XamlMarkHamill@hotmail.com (this all became very confusing when I was on the phone with XBox support).  My WP7 Marketplace account is fortunately tied to XamlMarkHamill also.  XamlMarkHamill is the Live ID I want everything associated with, but I want to keep my achievements associated with DHTMLKing and my plays and recommendations associated with fightclubber3xY.  Simple enough.

On the XBox console I can change the Live ID associated with DHTMLKing (yay) but not to a Live ID that is already associated with another Zune / XBox tag (boo).  On the Zune website I can change gamer tags (yay) but not if that gamer tag already exists (boo).  And on Zune for the XBox, I can create a new Zune Pass if I don’t already have one associated with my gamer tag / Live ID but I cannot simply associate my Gold membership with a pre-existing Zune Pass account (boo).  I can link my various Live IDs on http://account.live.com (yay) but this doesn’t really let these IDs know anything about each other – it just provides a link so I can switch between Live IDs more easily (meh).

I was told by the very patient XBox support representative to recover the Zune Pass gamer tag on the XBox (since it only exists on the xbox.com website but has never resided on my game console) and then try to associate that gamer tag with a new Live ID – but I remembered reading something on Yahoo Answers indicating that doing this would also move my Zune Pass associated with that bogus gamer tag to the new Live ID also, which would be self-defeating.

So we went with plan B – I deleted the gamer tag I had just recovered (the second bogus fightclubber3xY one, that is), with the idea that if I could just get rid of that tag, I would finally be able to transfer my good gamer tag to the Live ID I would be freeing up.  Unfortunately deleting the gamer tag I had just recovered doesn’t delete it from the Microsoft databases, it turns out.  It just possibly makes it dormant. 

I’m going to wait 24 hours in the hopes that 24 hours of dormant activity will kill that account.  I’m really not sure.  I think I have to stay away from the Live ID associated with that gamer tag and which I use for forums and my Zune Pass for 24 hours also.  I’ll call XBox support back tomorrow and see if any of this worked.  As far as I know, XBox gamer tags are supposed to be perpetual and are as hard to kill off as Jason Voorhees.

I really don’t want to dump on Microsoft.  It’s been a rough year with the off kilter rumors of WPF being dead and then Silverlight being dead and anxiety about whether the Windows Phone and Kinect will take off as well as they need to. 

But I’m really all in with Microsoft.  I develop on Microsoft technology and they have been very good to me over the past fourteen years helping me to pay my mortgage and clothe my children as a Microsoft-centric developer.  I’m also all in as a consumer with a Zune HD, an XBox, an XBox 360 which won’t play most of the games I bought for the XBox, a Windows Mobile device, a Windows Phone (delightful is the only word I can use to describe it under my NDA with Microsoft) and most recently a Kinect sensor (pure UX sweetness).  Microsoft has been amazing with innovation in the past year and even preparing for HTML 5 seems like a good move to me – change is the only constant … blah, blah, vampire emergency, blah … and developers really need to adapt to the market, after all.

I just wish the stuff that should be easy were easier.  Maybe linking large systems like the Zune and the XBox on the back-end isn’t as straightforward as changing a foreign key on this database table in the cloud or adding an index table between those databases in the cloud.  And Microsoft divisions do tend to be balkanized, even if they all ultimately answer to the same man.

I was really hoping for a person on the phone who could press a button and get all my online identities un-balkanized, though.  I feel like my Zune hand and my XBox hand won’t talk to each other and this is causing an identity crisis for us – for me, I mean.

 

[Update 11/7/2010 – I called XBox support back today after waiting the requisite 24 hours and it turns out that my vestigial gamer tag cannot be deleted.  Also, there is no way to merge the different accounts right now.  This is actually progress since the XBox rep knew right away that it can’t be done.  It’s a known problem!  Admitting you have a problem is, of course, the first step towards curing it so I have high hopes. 

No timeline on when a solution will be available, but apparently lots of people are asking about how to merge their accounts now that Microsoft is encouraging them to use unified Live IDs, XBox gamer tags and Zune passes.]

Telerik RadControls for Windows Phone: First Look

Telerik has been quick to fill in some of the gaps in Windows Phone development with the new RadControls for Windows Phone.  They made a similar move previously with their support for ASP.NET MVC and, going back even further, jumped in earlier than most control suite developers when Silverlight first came out.  Jumping onto new technologies in this is always a risky proposition – and I am grateful to Telerik for repeatedly doing this.  I truly hope it pays off for them.

While the Windows Phone platform was still in CTP and Beta, the main course for extending the control library was to incorporate open and proprietary projects such as the Silverlight 3 Toolkit, Silverlight 3 SDK, and Silverlight Contrib.  This usually worked but there were always issues with making everything play smoothly. 

As the marketplace rules were released, it also became evident that all controls would have to be compiled against the WP7 runtime, which made things just slightly hairier.  Eventually Microsoft released its own official Silverlight Toolkit for Windows Phone, which provides the most requested UI components: a Pivot Control, Panorama Control and Date and Time Pickers which are consistent with the other native apps built for the phone.

The RadControls for Windows Phone has some overlap with the Silverlight Toolkit for WP7 – no doubt due to fluctuating expectations about what actually would be provided in the Microsoft Toolkit and what would be most useful in a suite.  Duplications include the Date and Time Pickers, Picker, and the Wrap Panel.

The UniformGrid, DockPanel, and Window controls are found in RadControls but not in the Toolkit.  Window is probably one of the most useful of these controls.  It has functionality similar to the ChildWindow control from the Silverlight 3 SDK and allows us to build modal windows – very useful when a MessageBox will not suffice and especially when a phone application requires an initial login – the tales of woe surrounding building an initial login that complies with the Marketplace rules are legendary.  Telerik also continues a tradition of porting nice-to-have WPF functionality to Silverlight.  The standout in their phone suite is the LayoutTransform control which allows us to use Layout Transforms instead of just Render Transforms (for an illustrative example of the difference, see Charles Petzold’s blog entry).

For those having trouble with page transitions, Telerik provides assistance with their implementation of the PhoneApplicationFrame.  There has been a technique going around the internet involving cannibalizing the Silverlight 3 Toolkit and customizing the default PhoneApplicationFrame in order to set all page transitions from one location.  Telerik has simplified the process by providing their own implementation.

The RadControls are still in Beta and I know better than to judge the final work by any issues I find in the preview.  That said, the RadControls for Windows Phone examples seem remarkably and pleasantly performant – especially the page transitions. 

Telerik’s RadControls for Windows Phone are a great addition to the Windows Phone ecosystem.  Telerik is definitely on the right track and their controls provide what any Phone developer would want – an easier way to build interesting and attractive WP7 applications with tools to make development go faster.