Implementing Trial Functionality for Windows Phone applications

by Valentin Stoychev | Comments 8

As part of the Telerik “Q1.2012 Beta” package for Windows Phone we are releasing a new set of "Application Building Blocks" components. You can find more info on the idea of Application Building Blocks here

Overview

Part of the application building blocks are the RadTrialApplicationReminder and RadTrialFeatureReminder components. With these 2 components developers can implement and adjust the trial functionality of their applications. You can implement application-wide trial notifications, or feature-specific trial notifications, with a lot of configurable options. Both components support time-based and usage-based trial restrictions. Here is the list of the implemented features:

  • Optional free period (time based or usage based), when no trial reminders will be displayed,
  • Reminders recurrence – after the free usage is expired trial reminders can be configured to be displayed on a given period/usage,
  • Trial ended notification message,
  • Option for end-users to skip trial reminder recurrence (trial-ended message is always displayed!),
  • Configurable message box content

The timeline below summarizes the logic of reminder messages display:
Implementing Trial Functionality for WindowsPhone/WinRt
Here is how a sample trial ended notification looks like:
Implementing Trial functionality for WindowsPhone/WinRt apps

Implementing Application wide trial functionality

Using the trial reminder is quite simple and is only a matter of configuration plus one line of code for notification.
1. Define and configure the application trial reminder in your App class:

private static RadTrialApplicationReminder trialReminder;
  public static RadTrialApplicationReminder TrialReminder
  {
   get
   {
    if (trialReminder != null)
    {
     return trialReminder;
    }
    return new RadTrialApplicationReminder()
    {
     AllowedTrialUsageCount = 5, // maximum number of app runs until trial is expired
     FreeUsageCount = 2, // number of app runs when no reminder will be displayed
     OccurrenceUsageCount = 1 // reminder will be displayed on every run after the free usage is over
    };   
   }
  }

2. Notify end users for trial when needed:

App.TrialReminder.Notify();

This code is best to be placed in the first page of your application.

3. Disabling application functionality when trial is expired:

PaidButton.IsEnabled = !App.TrialReminder.IsTrialExpired;

You can use the IsTrialExpired property to disable specific functionality in your applications.

Implementing trial reminder for specific paid feature

There are many real world scenarios when you will want to have trial for a specific paid feature(s) and to leave the usage for the rest of application completely free. In this case you can use the RadTrialFeatureReminder. This component has the same logic for displaying the reminder messages as the ApplicationReminder, with two additional properties – UsageCount and FeatureId.
Here is how to use the trial feature reminder:
1. Define and configure the reminder:

paidFeatureReminder = new RadTrialFeatureReminder()
   {
    FreeUsageCount = 1,
    OccurrenceUsageCount = 2,
    AllowedTrialUsageCount = 7,
    FeatureId = 1
   };

2. When feature will be executed:

private void Button_Click(object sender, RoutedEventArgs e)
  {
   paidFeatureReminder.UsageCount++;
   paidFeatureReminder.Notify();
 
   if (paidFeatureReminder.IsTrialExpired)
   {
    return;   
   }  
 
   // perform the feature actions
    
  }

As you can see with these two components you can implement very easy and in a flexible manner the trial experience of your application.
I hope that this component will be very useful for you - please give it a try during the beta period and let us know if you have suggestions for enhancements.

You can also find me on twitter @valiostoychev – I’ll be happy to discuss any feedback you have!

,
Team Leader,
Windows Phone Team

 

8 Comments

Michael
This kind of thing should just be built into the framework already.  Since it's not, I'm glad you guys did it.  Thanks!
Buns
What good is paidFeatureReminder when MS doesn't allow us to use IAP for games?
Ion Singh
Nice
Mikael Koskinen
Thanks for a good overview of this feature.
For those who want to test this with the emulator, there's a "SimulateTrialForTests"-property in RadTrialApplicationReminder which can be set to enabled. For example the following code can be used:

#if DEBUG

 

 

 

trialReminder.SimulateTrialForTests =

 

true;

#endif


Chris Johnson
Can't they just uninstall the app and re-install it to get another free trial period?  
I limit functionality currently, but really i would like my trial to be fully featured but time limited.  But right now I cant do that since they can just uninstall/re install and get fresh start. 
Valentin Stoychev
Hi Chris - you are right and if you care about this - you can use only the trial reminders. Having a free period/usage is optional and in some app scenarios may not be the best option.
Manfred
If I call App.TrialReminder.Notify(); then I receive an exception "ApplicationUsageHelper class should be initialized before using this component.". Do you have any idea?
BTW: Can you provide the sourcecode of your example?

Comments

  1.    
      
      
       
  2. (optional, emails won't be shown on public pages)
  3. (optional)
Read more articles by Valentin Stoychev - or - read latest articles in Developer Tools
Product Families