Search code examples
c++nativewindows-phone-8cocos2d-xtrial

How to implement trial experience in native C++ application (without XAML)


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++


Solution

  • 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.