I added a trial mode to our game and I am having some problems forcing an exit when the trial mode has expired. Originally I was getting an exception in the UnityPlayer.dll in some Memory Profiler call when I called App.Current.Exit() during the OnLaunched method in the XAML project. Here the game would launch, I would determine the trial mode has expired, and if the user chooses not to buy the full version, the game would exit. I fixed this occurrence by delaying the call to [appCallbacks = new AppCallbacks(false);] until after I finished with the license boot up testing.
So now I still have a problem where the trial period expires while the user is still playing the game. Again, I prompt them to see if they would like to buy the full version. If they decline, I attempt to close the application, again by calling [App.Current.Exit()]. As mentioned, this causes an exception in the call [UnityPlayer.dll!MemoryProfiler.UnlinkHeader]
I will continue to debug this, but my main question is, is there some proper method of shutting down a Unity Win8 App Store application that I am overlooking?
I remember that, but once I started researching the trial mode I came across this:
•Trial license expires while the app is running
If the trial expires while your app is running, your app can:
◦Do nothing.
◦Display a message to your customer.
◦Close.
◦Prompt your customer to buy the app.
The best practice is to display a message with a prompt for buying the app, and if the customer buys it, continue with all features enabled. If the user decides not to buy the app, close it or remind them to buy the app at regular intervals.