How to: Implement the Trial Experience in Your Application for Windows Phone

This is pre-release documentation for the Windows Phone OS 7.1 development platform. To provide feedback on this documentation, click here. For the Windows Phone OS 7.0 developer documentation, click here.

May 19, 2011

This topic describes how you can implement the trial experience in your application for Windows Phone.

The trial experience you choose can be simple or complex, but there are three basic tasks that your application must perform to allow a user to purchase your application from within the trial mode.

  1. Differentiate trial and full mode behavior

  2. Provide a path to purchase your app

  3. Define a trial limit experience

For example, you have designed a level-based game. You decide that:

  1. A user who tries it can play the first level as many times as they want, but needs to purchase the game to go to higher levels.

  2. Every time a user reaches completion of the first level of the game, the application invokes the trial limit experience.

  3. At its trial limit, your application displays a “Buy Now” page that contains two options: purchase the application or replay the first level.

The user experience of this design is illustrated in the following figure.

Application User Experience

Use of the XNA GamerServices.Guide class

XNA Game Studio developers should use the Guide class in the GamerServices namespace to differentiate Trial and Full mode behavior and provide a purchase path for their Games. For more information, see Simulating Trial Mode for Marketplace Content and Guide.ShowMarketplace Method.

Silverlight developers may also use the Guide class in order to make testing and debugging of trial applications easier. Options and coding practices are detailed in the How to: Test and Debug your Trial Application for Windows Phone topic.

The LicenseInformation.IsTrial Method for Silverlight applications.

This method is located in the LicenseInformation class of the Microsoft.Phone.Marketplace namespace. You can call it to get the current license status where it makes sense for your design to differentiate between trial and full mode behavior.For the trial limit behavior described in our example, your code might look something like this:

using Microsoft.Phone.Marketplace;

public LicenseInformation licenseInfo = new LicenseInformation();           

private void Level_One_Over ()
{
  if (!licenseInfo.IsTrial())
  {
    Enter_level_2();
  }
  else
  {
    Show_Buy_Now_Page();
  }
}

The MarketplaceDetailTask.Show Method for Silverlight applications

This is a method of the Microsoft.Phone.Tasks namespace. Calling this method opens the Windows Phone Marketplace application and navigates to the Detail page. The Windows Phone Marketplace will tombstone your application. If the user buys the application and confirms the purchase, the trial license is replaced with a full license. When the application resumes, it must re-query the IsTrial() method to detect the change of license and transition to the behavior that is associated with a full license.

For the “Buy Now” button behavior described in our example, your code might look something like this:

using Microsoft.Phone.Tasks;
public MarketplaceDetailTask detailTask = new MarketplaceDetailTask();
private void buy_now_Click(object sender, RoutedEventArgs e){
  detailTask.Show();
}

Conversion from Trial to Full Mode for Silverlight Applications

After a user makes their purchase choice and closes the Windows Phone Marketplace application, they are returned to your application. In some cases, the user may have to find and restart the app. This is a point where your application must recheck the trial state of the license to determine if a purchase has been made.

For the “Continue” button behavior described in our example, your code might look something like this:

private void continue_Click(object sender, RoutedEventArgs e){
  if (!licenseInfo.IsTrial())
  {
    Enter_level_2();
  }
  else
  {
    Enter_level_1();
  }
}

Show: