0

Can I implement trial mode in my native c++ application (cocos2d-x-win8)

All examples shows C#/XAML and I cannot find anything working in c++

2
  • Sure: Use try { /* main program */ } catch (...) { }. You can use the catch block to handle users who jump ship.
    – Kerrek SB
    Jan 14, 2013 at 21:24
  • Do you mean "try my application for X days" or some such? Jan 14, 2013 at 21:28

1 Answer 1

1

I'm not sure if you're asking about Windows 8 or Windows Phone 8 but luckily the answer is pretty similar. On WP8/Win8 from C++/C# you should use CurrentApp.LicenseInformation.IsTrial. However, due to a bug in WP8 invoking CurrentApp::LicenseInformation->IsTrial on the app's main thread will throw an exception. So you should on a different thread:

ThreadPool::RunAsync( ref new WorkItemHandler( [](IAsyncAction^ operation)
{
auto value = CurrentApp::LicenseInformation->IsTrial;
})); 

However, do note that the Win8 store offers a built-in time limited trial and WP8 store doesn't offer that by default. In WP8 you should implement your own trial logic.

3
  • Thanks @JustinAngel, but I still got some problems with WP8 trial auto value = CurrentApp::LicenseInformation->IsTrial; the above code in my emulator always returns false, is it enough to run above code only or shall I configure my app somehow in order to make it "trial enabled"
    – michael
    Jan 21, 2013 at 21:51
  • WP8 Emulator doesn't support CurrentAppSimulator like Win8 does. Basically, CurrentApp doesn't have development time support. See wrokarounds @ msdn.microsoft.com/en-us/library/windowsphone/develop/… Jan 22, 2013 at 3:43
  • Thanks, but is it enough just to use above code in my application when I will release it to the market, or shall I add some more configuration (like metadata, xml, etc.)? to my project before a release? I assume that now it returns 'false' but when released to the market it will return a 'true' when it is in trail mode and 'false' when user bought an app?
    – michael
    Jan 22, 2013 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.