How to implement trial functionality in windows phone app

This topic describes how to implement a trial experience in your Windows Phone app.
The purpose of a trial experience is to give the user an opportunity to try your app before they commit to buying it. In a trial experience, you typically offer a limited version of your app, for example, by disabling features, by disabling levels in a game, or by setting a time limit on using the app. The limitation you choose for your app is entirely up to you.


I will be demonstrating this with the help of an example. Suppose there are two pages in an application out of which only one can be opened in trial version that is first page .

In full version of the application you can open both the pages that is first page and second page.

The steps to followed to implement trail functionality are


1. First create a blank project and name it Trialapp.

2. Then open App.xaml.cs and add the following using directive to the top of the page

  3. In the App class, declare the following local static variable. The LicenseInformation class enables an app to determine if it is running under a trial license.
4. In the same App class in App.xaml.cs, add the following read-only property and local variable. This property is used to cache the license information while the app is running. The app uses the property whenever the current license information needs to be checked.


5.In the following sections, the license information will be checked in the Application_Launching and Application_Activated event handlers. Since this logic is used in two locations, we wrap it for convenience into its own method. In the App class located in App.xaml.cs, add the following method.    


6. Then open the MainPage.xaml and remove the XAML code for the Grid named LayoutRoot and replace it with the following code.



7. Then add two more pages to the application and name it Firstpage.xaml and Secondpage.xaml.



8. Open the Page Firstpage.xaml and change the application name to trial app and page name to first page. Similarly do it for Secondpage.xaml and change the page name to Second page.



9. In the MainPage.xaml.cs  code-behind file, add the following methods.


10. Now run the application in debug state you will see that the app runs in trial mode as the value of _isTrial in App.xaml.cs is true. The following screen will appear before you and the second button will be disabled.



11. Now when you will change the value of _isTrial to false the app will run as full version.



12. While submitting the app to store you need to tick the checkbox of trial functionality in your app. You can do this easily. Go to your dashboard. Select your app. Go to the app info page and check the checkbox.




Note: If you forget to check this checkbox you app will be available in full version to all the users in the marketplace.


13. You can download the Project zip file from the link given below.


Download full project


Chetan Gulati

Currently am doing B TECH in IT from Delhi Technological University. App development is my passion. Believe in quality rather than quantity.

Read more:
How to create your first Windows Phone app
How to change the App name and Tile name of your Windows phone app
Data binding in Windows Phone app – One way binding