Skip to content

Making Your App Support Trial Use

One great way to get people to buy your app is to allow them to use some part of it to see how awesome it is and how they just must buy it!

Microsoft makes it really easy to add this feature to your app with the Microsoft.Phone.Marketplace namespace.

Now, there are two different scenarios that you would use trial versions, one is in a Silverlight app and the other is an XNA (game) app.

In both scenarios you need to include the using for the class:

using Microsoft.Phone.Marketplace;

Also you for both scenarios you will want to add the instance of the LicenseInformation object to your app:

/// <summary>
/// Holds the current Licensing Status of the application.
/// </summary>
public LicenseInformation license = new LicenseInformation();

In your Silverlight app you would want to add these to App.xaml.cs and in in your XNA app you would want to add this in your first Game class.  This way, you will only instantiate it once.

You will want to also create a boolean value to hold the output of the IsTrial method from the LicenseInformation object.  You do not want to run this method more than once while your app is running or you could end up with a performance hit, especially in XNA apps.

        /// <summary>
        /// shows if the currently running
        /// game is a trial version.
        /// </summary>
        bool isTrial;


Now in the constructor of your app’s main class (App in Silverlight, Game in XNA) you will want to add the call to the IsTrial method to populate the value if isTrial:


        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
            //get trial status
            isTrial = licensing.IsTrial();


        /// <summary>
        /// Constructor for your game
        /// </summary>
        public Game1()
            //get trial status
            isTrial = licensingInformation.IsTrial();


isTrial will now be true if the user has not bought the app and false if they have already purchased it!.

Now that you have that info, you can use it to trigger your trial check code wherever you want in your app!!!  You can use a timer to allow a certain amount of use (popular for games) or you can only allow a certain amount of data to be stored or entered in your app.

Posted in C#, Game Development, Silverlight, Windows Phone 7, XNA.

3 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Arnold says

    This is very informative Atley. I shall be implementing this in my future Apps. Thank you.

  2. Harald-René Flasch says

    Thanks a lot! Seems really very easy to do 🙂

    –Harald-René Flasch (aka hfrmobile)

    PS: “Microsoft makes it really easy to add this feature to your app with the Microsoft.Phone.Marketplace class.” –> Microsoft.Phone.Marketplace is not a class, it is a namespace and LicenseInformation is a class within that namespace.

    • Atley says

      Thanks for catching that! You are, of course, correct. I have made the change.

Some HTML is OK

or, reply to this post via trackback.