Jaa


Trial experience for apps, first steps

My Windows Phone app, Interval Arithmetic, implements a trial experience. The first thing I did when it was published was to install the trial on my own phone, and then use the buy option on the app bar menu. I wanted to satisfy myself that forking over clams would actually allow access to the full app. It did but, in my case, only after restarting the app, which is not ideal. I should have designed my app to check its license on resuming, as the docs told me to, so that the still-running instance would light up on returning from the Store. I set out to make that improvement, and here are some notes on my progress so far.

During the app's development, I had written a helper class called LicenseInformationHelper as a simple interface to the LicenseInformation class (Microsoft.Phone.Marketplace namespace). I'd learned about that type from the article How to implement a trial experience in a Windows Phone app, which is good for both Windows Phone OS 7.1 and Windows Phone 8. But my app is Windows Phone 8, and there's a LicenseInformation type in Windows.ApplicationModel.Store which works for Windows Phone 8 and Windows 8 Store apps. So I switched my helper class to use that.

I also began sharing or re-purposing the source files in a Windows Store app project, so I made a few tweaks to LicenseInformationHelper to compile and behave appropriately depending on whether WINDOWS_PHONE (Windows Phone) or NETFX_CORE (Windows Store) is defined. LicenseInformationHelper gets and caches license information only on activation (during static construction) and resumption of the host app (it adds a handler to PhoneApplicationService.Current.Activated or Application.Current.Resuming as appropriate). It adapts LicenseInformation's interdependent IsActive, IsTrial, and ExpirationDate properties into a LicenseModes enum (Expired, Full, MissingOrRevoked, Trial). And it exposes ExpirationDate (for Windows Store apps) and an IsFull property. IsTrial isn't ideal for turning off features, because you have to cross-reference it with IsActive, so I found an IsFull property to be more useful.

The difficulty with LicenseInformation is that it only behaves correctly when it's being called from a published app, and a published app means a retail build. So I added a feature to LicenseInformationHelper so that you can configure in source code, for a debug build, what mode the app is in initially and on resumption. That way you can simulate the transition from trial to full by navigating away from the app and then back to it. Your buy functionality is one way to do that. But the helper is still useless in an unpublished retail build. With a Windows 8 Store app, I know that I can use CurrentAppSimulator, but I'm resisting doing that right now for reasons that are not important enough to mention here. I may try that some day.

Anyway, I built a simple Windows Phone 8 demo app around LicenseInformationHelper, hoping to publish it as a beta and test it that way. But the beta program doesn't support trial mode. It would be great if it did, or if there was a staging Store. Until then, the only way I can really know how that all-important transition from trial to full is going to behave in front of customers is to publish to the Store and purchase.

So that's what I've done with my LicenseInformationHelper demo app. I've submitted it to the store, hidden from browsing or searching, with a trial mode and a purchase price of 99c. If it passes certification, and it works, then I'll feel confident using LicenseInformationHelper going forward. I'll still need to verify the Windows Store side of the house. But, once I'm satisfied, I'll write a post here, sharing the source and documenting its use. Either way, I'll keep you updated with what happens.