Free, Trial and Paid apps

So you have created an app. How do you decide whether to make it paid or make it ad supported etc. If you have invested lot of time and effort, you might rightly decide to make it paid… i did 🙂 for last 3 months i’ve had 1 free app and 3 paid apps.
Stats are:
Learn To Write: 10
Alarm Clock: 50
Slydr: 750

If the app is being used for a while (the duration user uses it is long), you might consider making it ad supported. there are lots of ad sdks out there.. I have tried a few. Microsoft will be allowing non US Developers to use its ad network soon. For now i have settled on AdDuplex.com: the good thing, it pays per impression rather than click. current payment is $0.70 per 1000 impression.

So how do we go about supporting Free, Trial and Paid versions with a single codebase ?
Is there a difference: well not much. From my own experience

Say you allow your app to be purchased for 0.99, you can choose to allow Trial when publishing the app. This is just a licensing tweak. No difference in what is delivered to the client (except the license).
Most Trial are either restricted or fully-functional but ad-supported ( I have gone both routes).

for now i have settled on fully functional ad-supported free / trial. The only problem is a free app is nothing but an app sold at 0.00. So you need to make two submissions
1) Make it ad supported only and publish it at 0.00
2) Make it paid and enable trial.

if the app is free or trial, i show ad control (tweak it every 15 seconds) so it alternates with the app title.

Lets get started – open your application solution in visual studio.

now in menu click Build >> Configuration Manager.
Expand the dropdown under ‘Active solution configuration’ and select New

Make sure that you copy existing settings from say Release. I have called the new configuration ReleaseFree.
Click Ok.

Similarly create another configuration called TRIAL (i choose to copy settings for debug for simplicity – this is only used for testing).

The new configurations will now be available under build / run dropdowns.

Now lets open the Project properties. Navigate to Build.
Select Trial as the configuration and add new conditional compilation symbol called “TRIAL”
Select ReleaseFree configuration and add new conditional compilations symbol called “FREE”

Save the project file and close it.

Let the coding begin 🙂
Open App.xaml.cs and lets define a boolean property. we make it static for easier accesss from other pages.

Lets also add a method to simplify testing of Trial / Paid mode.

public static bool IsTrial { get; private set; }

public static void DetermineIsTrail()
{
#if TRIAL    
      IsTrial = true;
#else
      var license = new Microsoft.Phone.Marketplace.LicenseInformation();
      IsTrial = license.IsTrial();
#endif
}

Now you can see why we defined the TRIAL config and TRIAL symbols 🙂 We can manually set IsTrial to true / false while testing our app using Trial configuration.

Now in the mainpage.xaml.cs

bool bShow = true;
DispatcherTimer dtToggleAd = new DispatcherTimer();

private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
     try
     {
           dtToggleAd.Interval = TimeSpan.FromSeconds(15);
           dtToggleAd.Tick +=new EventHandler(dtToggleAd_Tick);

#if FREE
           this.spTitle.Height = 80;
           dtToggleAd.Start();
#else
           if (App.IsTrial)
           {
                 this.spTitle.Height = 80;
                 dtToggleAd.Start();
           }
#endif      

void  dtToggleAd_Tick(object sender, EventArgs e)
{
#if FREE
     bShow = !bShow;
#else
     if (App.IsTrial)
     {
           bShow = !bShow;
     }
     else
     {
           bShow = false;
     }
#endif 
     if(bShow)
     {
           this.adControl1.IsEnabled = true;
           this.adControl1.Visibility = System.Windows.Visibility.Visible;
           this.spTitle.Visibility = System.Windows.Visibility.Collapsed;
     }
     else
     {
           this.adControl1.IsEnabled = false;
           this.adControl1.Visibility = System.Windows.Visibility.Collapsed;
           this.spTitle.Visibility = System.Windows.Visibility.Visible;
     }
}

thats it really…
Test both trial and paid modes (select TRIAL in configuration) and make sure you set IsTrial to True or False depending upon your test case.

When satisfied, Build the Paid / Trial xap by choosing Release from configuration
Build Free by selecting ReleaseFree configuration. (you might want to change app title in project file temporarily to AppName Free) just to symbolise the free nature of the app 🙂

Or just use choose Build >> Batch Build and select both Release and Release Free (and build)

I’ll talk about how to provide the option to convert Ad supported Free / Trial input paid app tomorrow

One thought on “Free, Trial and Paid apps

  1. Pingback: Managing Free and a Trial / Paid in the same code base in Windows Phone 7 - Popular Windows Phone Questions

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s