Implementing trial functionality is a very useful method when you want your user to use limited features free of cost and for unlocking remaining features you want him to pay you.

There are two types of trials available in windows apps:

Time Based Trial

To set a trial-based app, the user has to set a time or date calculation mechanism in the store app. The store will take care of the app when the trial period ends, so the developer need not worry about the usage of the app after trial period. While submitting the app in the store the developer has to specify the trial period in days for the app as shown in figure. The trial period starts when the user downloads and installs the app from the store.

Feature-Differentiated Trials

When the app trial period expires, the developer can display a message to the customer regarding the expiry of the trial period or send a notification in advance. The developer has to send these reminders using the time-based trial period.

To check whether the app is in trial license, the developer can write code as shown in following Code Snippet.

private async void getLicenseInfo()
 {
 //license info is retrieved
 var l = CurrentAppSimulator.LicenseInformation;
 if (l.IsActive)
 {
 if (l.IsTrial)
 {
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
 {
 result_lbl.Text = "License status: Trial license";
 var r = (l.ExpirationDate - DateTime.Now).Days;
 result_lbl.Text += System.Environment.NewLine + String.Format("Remaining days: {1}", l.ExpirationDate, r);
 });
 }
 else
 //otherwise set message to full version
 {
 await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, ()=>
 {
 result_lbl.Text = "License status: Full license";
 result_lbl.Text += "no expiry";
 });
 }
 }
 else
 {
 //Please Renew your license
 }
 }

Once you build your project you will get the output like this:

trial functionality windows universal apps store apps metro apps

That’s All

Happy Coding