Windows Phone 7 Trial API Walkthrough

The Windows Phone 7 Trial Mode functionality is a power and simple tool. For those unfamiliar, the Windows Phone Marketplace allows for developers to list their applications in three ways: Free, Buy, and Try-Before-Buy. In order to be more marketable, it is usually a better option to offer customers the ability to try out an application before they give you their hard earned money. Another difference between this approach and other phone marketplaces is the user experience for upgrading their app from trial to full version. It is a simple two-click process, one click to upgrade, the other to confirm the purchase.

Implementing the trial mode code is a very straight forward exercise. Here is an example:

Microsoft.Phone.Marketplace.LicenseInformation license = new Microsoft.Phone.Marketplace.LicenseInformation();

public string ApplicationTitle
        {
            get
            {
                if (license.IsTrial() == true)
                {
                    return "My App (Trial Version)";
                }
                else
                {
                    return "My App";
                }
            }
        }

The above example demonstrates how we can change the way the app behaves for a trial user versus a fully licensed user. In this case we are changing the Application Title of the app. A trial user will see “My App (Trial Version)” at the top of their screen and a fully licensed user will see “My App”. Not very limiting, I know, but it demonstrates how easy it is to implement this in your code.

The code implementation is simple because Microsoft is doing much of the heavy lifting here. The Microsoft.Phone.Marketplace.LicenseInformation class uses Microsoft’s Zune Marketplace to check the license currently installed on the phone. It returns true if the license is a trial version and false if it is the full version. This leaves the developer to spend writing code and polishing the user experience rather than writing their own licensing services or writing a completely separate trial version of their applications.

0 comments: