If you want to monetize your UWP apps, it might be part of you plan to have some kind of trial so that uses can try out the basic functionality of your hard work. This can be achieved in two places, firstly you need to test and set the properties in the app. Then you need to change the properties of your app submission in the Windows Dev Center. So here I will cover how we write the code to test for a trial installation of your app.

In my MoonPhase app, I have limited some functionality in the trial version. Basically a user can view the current details on the Moon, but if they want to move forward or backwards in time to see what the Moon looks like on different days, then a message popups up to tell them they cannot do that in the trial. This way they get to use the basic functionality and if they find the app useful, then they can pay for the full version in the app store.

Trial Functionality in UWP

So here is the logic I have in the JavaScript for the view

The ‘message’ element is a div in the HTML that the fly out will append to when the ‘previous’ button is clicked.

In the JavaScript listing above there is a call to getLicenseInfo(), this function takes in a Boolean that if set to true then it is in trial mode and needs to use the CurrentAppSimulator as opposed to the CurrentApp. The CurrentAppSimulator does just that, it simulates certain properties of the application that you have control over.

So to test locally simply pass in true.

var licenseInformation = getLicenseInfo(true);

The CurrentAppSimulator will then look for the WindowsStoreProxy.xml file that resides on your drive, usually somewhere like this:-

%UserProfile%\AppData\Local\Packages\<app package folder>\LocalState\Microsoft\Windows Store\ApiData\WindowsStoreProxy.xml

Depending on what you are testing for, you can populate the sections you need. I am testing for a trail version, so set the IsTrial within the App element to true. You can now run the app in the debugger and you can step through your code to see what paths it is taking. In my case I show the message fly out notifying the user of the trial status.

One thing to remember though is to take out the Boolean or set to false before submitting to the store. I am still looking for a better way to handle this and was hoping there would be some sort of pre-processor functionality like what is used in C# that could be switched when in debug mode.

Submitting Through the Windows Dev Center

So once you are happy to publish the app and the Boolean has been taken out or set correctly, go to the ‘Pricing and availability’ section of your submission.

image

The use the drop down to set the trial period.

image

When a user first installs the app in trial mode the real IsTrial property will be set to true and each time the app launches it will check the install date and if this is still set to true then the app won’t launch and the user will be presented with a Windows dialog to prompt them to purchase from the store. When they do purchase, then the IsTrial is set to false and they get all the functionality.

Happy coding

I am posting this here as somebody else thinking of creating store apps for Windows 10 might thing it interesting. I intend on following this post up with another about app promotion techniques.

App Statistics

Once you have an app published in the Windows Store, you can get to a wealth of information about which markets, demographics and devices are the most popular. This is in the form of in browser views, but you can also download the raw statistics for analysis using Excel for example as I have done here.

I have 5 apps in the store currently, but I am only going to concentrate on 3. MoonPhase is the oldest and has been in the store since Windows 8 was first released. It has over 6000 downloads to date and has recently been migrated to a Windows 10 UWP app. It was originally free, but I started changing for it a couple of months ago. I don’t make a huge amount of money from this app, but its better than nothing.

image

Looking at the past 30 days acquisitions and usage, the United States comes at the top of both with UK second.

Next is WebUp, this is another paid app which is just under two months old. It is aimed at the enterprise market sector that is responsible for web site monitoring, whether that be corporate intranets or public facing web sites.

image

These stats are a bit strange as they show United States download more, but the UK use the app more. Is there something stopping the US from using the app more after they have paid for it?

Both MoonPhase and WebUp show that the United States are quite happy to spend money in the store even if they don’t get the full use out of the software. The UK looks like they are better at getting more bang from their buck (or pound). WebUp is more expensive than MoonPhase which might be the reason the UK is lower in acquisition rates. I am about to run an experiment where both apps will be priced much lower and I will see if the price is forming a barrier to UK acquisition rates.

Thirdly is GetWalking. This is a free app aimed at the personal health sector, it is a simple pedometer that measures both distance walked and steps taken. It is the youngest of the 3 apps as it has only been in the store less than a month. I do intend on monetizing this app, possibly through advertisements, but not entirely sure yet. There are more features I wish to add, but currently I am just getting some stats in an MVP kind of way.

image

The chart shows that the UK has both the highest acquisition and usage, again with the US second in acquisitions, but strangely China overtakes it with usage. It seems that the Chinese market get more use out of this app than the US.

Interestingly all three app show that both the US and UK are either at the top or near the top of the charts in acquisition and usage. I am a UK based developer and these apps are published in all the markets that Microsoft allow, so I was expecting there to be more numbers from markets such as India and China. Is it a language thing perhaps?

Also very strange that an app can be used in the United Arab Emirates, but never acquired from there. Does this show that app statistics are not entirely tied to a users country of origin (Windows account country registration)?

None of these app have undergone any app promotional exercises except I have blogged about MoonPhase and WebUp. The Windows Store statistics show that all 3 of these apps get views from users coming to the store and searching not from outside search engines or sites such as Google/Bing or any of my previous posts (except for a handful, not worth bothering with).

My next task is to try and promote these apps more outside the store.

WebUp is a new website monitoring tool that can also be configured for other endpoints such as web API urls. It is live in the Windows store as a UWP app, which means it can run on mobile, desktop, tablet and Xbox.

image

Why UWP?

The Microsoft ecosphere for app development, although on the mobile side is way behind both iOS and Android, has huge potential with everybody who runs Windows 10 included no matter what device. Here are some of the reasons I chose to publish on the Windows app store.

Auto updating

Any change I wish to make to the app once gone through certification will auto update on the end users machine leaving them with an always up to date version with no user input. Gone are the days when a new version of an application comes out, you got to go to the site, download and then install it.

No credit card information collected

WebUp is free for a trial of 7 days, but some of the features are locked out until upgraded to the full version. This payment process is entirely handled by Microsoft and although there are payment methods out there such as Stripe, as a developer I don’t need to lift a finger, just specify the price.

Runs across multiple devices

UWP apps are compiled once, but each architecture is included which means once a package is uploaded to the Windows Store, it is available for any Windows 10 device. WebUp gives a great experience on a tablet sized machine, but some users are running it on an Xbox with a massive display and using it as an information radiator. The mobile version is great when you need to whip out your phone and just check the status of your web sites.

User can multi install

The Windows Store allows a single user to install the app on up to 10 devices giving them the freedom to run it in multiple locations on different devices. WebUp can be installed on Xbox for an information radiator but you can also have it running elsewhere in an organisation with a different subset of http end points showing. A manager can also have it on their mobile device connected to the local Wi-Fi giving them satisfaction that everything is running fine.

Don’t need to worry about account management

With more traditional web based monitoring solutions, username and passwords need to be configured to log into the service, with a UWP Windows app, the installation is linked to the Microsoft account of the user so no more little yellow notes with credentials stuck to the monitor.

Can be installed inside enterprise and behind corporate firewall

As the app is installed to the device and not hosted by a third party such as SaaS providers, no holes need to be punched through the firewall if all your http end points are internal.

So those are some of the reasons I opted for UWP, it is early days at the moment, but I am already getting some traction and have other features in mind for the app.

Catchy title, but it explains exactly what is in this post.

I have just released an update to one of my UWP apps called WebUp. The additional functionality I added was email notifications when a http end point went offline. There are different ways you can message from a UWP app, but I wanted to use SendGrid to manage all messaging, so in this post I will cover adding this functionality from a UWP app written using WinJS. So yes it is possible to consume C# functionality from JavaScript and it is easier than you think. Why SendGrid you may ask, simply that they allow you to send 12 thousand emails per month for free, can’t grumble with that.

Windows Runtime Component

This is a dll that can produce winmd metadata that can then be consumed by UWP app written in any supported language such as C#, C++ and even JavaScript. Although the functionality can be limited somewhat, they can be used to create wrappers around libraries that cannot usually be accessed in a UWP app.

What is WinJS?

This is a JavaScript framework from Microsoft that can allow the developer to quickly add functionality to UWP apps. Although originally developed just for creating Windows Store apps, more recently this library has been open sourced and can be used as a framework to create web applications. It can still be used however to create UWP apps using the JavaScript template in Visual Studio.

Creating the app

Firstly create an app using the basic WinJS template in Visual Studio.

image

Choose the target and minimum versions.

image

Now a new project is needed to be added to the solution, so right click the solution.

image

Choose Windows Runtime Component under the C# collection.

image

Right click the references of your main UWP project and add this component.

image

To use SendGrid for messaging, the best component to use is called LightBuzz and can be found here:- https://github.com/LightBuzz/SMTP-WinRT

Although it’s easy to add references via NuGet, for some reason with UWP apps created this way, the library was not copied locally, so I cloned the repo from GitHub and built the project locally giving me a nice shiny library I can then reference old school.

image

Just make sure it is set to copy local in its properties.

Now for some code.

In the class code auto generated when you created the Runtime Component, make sure you have the using statement for LightBuzz.SMTP and add this code:-

When using SendGrid, you can add extra credentials to your account that helps separate out different usage scenarios. I have credentials set up for my WebUp app and I have used it here, just swap out with your credentials.

While in the Component code, have a look at the project.json file, it will list all the runtimes that are available for the component. When running this app,, you will need to change the environment to one of these as ‘Any CPU’ does not work.

image

Now back in the UWP code, add something like this to the app.onactivated function; obviously you will want to put it somewhere else, but for this example it will work.

Enter your email address and run the app. With any luck you should start to receive emails direct from your app via SendGrid.

When doing Continuous Integration and Continuous Deployment, sometimes its great to get your code into production but hidden from any end user actions. In this post I will outline what I have been using with great success on my SaaS application ObsPlanner. There are however loads of libraries and other tools that will do the same thing, but I opted for the more simple, home grown approach.

My application is an MVC application that uses Angular JS in the views to give a better end user experience by acting as a mini SPA, so C#, Razor and Angular need to know about what features are available and what is not.

The database structure is simple, a table with one column for the toggle name and another for if it is enabled like this:-

 

I am using Entity Framework for all my database work, so I have a FeatureToggleRepository that retrieves the data like this:-

Each of my MVC controllers inherit from a BaseController which has methods used throughout the site including the getting of toggles:-

Now each of my controllers can easily get the toggle list:-

Where the toggle list is added to a view model, in this case it includes the logged in user details as well as the toggles. So in the view I can use Razor to run a conditional against it like this:-

So that works great for the View, what about the Angular stuff, couldn't that break if certain elements are not present in the view? Well yes it could so in the JavaScript I simply have all my toggle code nicely wrapped in functions that only get called if an element with the correct id is present in the view like this:-

The setup for this site is a development, staging and live server all with their own copies of the database. So this method allows me to push code through the whole life cycle and simply switch on the feature on the live server when I am happy with it.

Happy coding