Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Guide.IsTrialMode work in MonoGame for a Windows 8 Store App?

I've been using XNA to make games for the xbox and windows phone 7. Now I want to create a metro Windows 8 Store app, using MonoGame.

I've successfully jumped through all the hoops and got it working, but am having an issue with Guide.IsTrialMode.

I have separate logic depending on whether the game is in trial mode or not which works on the other platforms, but when I test my app it either on the local machine, or in the simulator it always thinks I've not purchased the game. My worry is that when it's on the app store and people actually buy it, the logic won't change.

TL;DR: Does Guide.IsTrialMode work in MonoGame for a windows 8 store app and how can I test it?

like image 716
George Duckett Avatar asked Oct 22 '22 09:10

George Duckett


1 Answers

EDIT: In DEBUG, you can just set Guide.SimulateTrialMode in order to test one way or the other, it seems.


So here is the information regarding trial mode in Windows 8 Store Apps:

Create a trial version of your app

LicenseInformation class

Basically, it utilizes a bool flag licenseInformation.IsTrial. If you then dig into the MonoGame source code on GitHub, we can see how they implement the check:

#if WINDOWS_STOREAPP
    var licenseInformation = CurrentApp.LicenseInformation;
    ...
    isTrialMode = !licenseInformation.IsActive || licenseInformation.IsTrial;
#endif

So, it seems that your licenseInformation is either not set to active, or is set to trial if you having issues testing. The first link has information on how to test it, but I'm not sure how to extend that to MonoGame:

Now, test your app using simulated calls to the license server. In JavaScript, C#, Visual Basic, or Visual C++, replace references to CurrentApp with CurrentAppSimulator in the app's initialization code. CurrentAppSimulator gets test-specific licensing info from an XML file called "WindowsStoreProxy.xml", located in \Microsoft\Windows Store\ApiData. If this path and file don't exist, you must create them, either during installation or at run-time. If you try to access the CurrentAppSimulator.LicenseInformation property without WindowsStoreProxy.xml present in that specific location, you will get an error.

I guess in the worst case, you can build MonoGame yourself, changing CurrentApp to CurrentAppSimulator.

like image 69
lukegravitt Avatar answered Oct 24 '22 02:10

lukegravitt