Hi, We need to be able to get this http://msdn.microsoft.com/en-us/library/windows/apps/hh694065.aspx into our Unity project. Is it possible to do it from the Unity side via plugins (as opposed to bolting stuff on to the VS C++ project it spits out) -Or if someone knows of a plugin that can handle this we would be grateful. -Or a good tutorial on writing store plugins when using C++ output.
Hello. Actually, unity provides a wrapper for that API: http://docs.unity3d.com/Documentation/ScriptReference/Windows.LicenseInformation-isOnAppTrial.html http://docs.unity3d.com/Documentation/ScriptReference/Windows.LicenseInformation.PurchaseApp.html
I'm not sure this is complete because it should have a "licenseInformation.expirationDate" getter as well. I can only see this as a way of disabling parts of the app, however we want a limited trial with full functionality. We could always write our own time check, but how would we save this in such a way that when the app is removed-reinstalled it is not cleared?
You're right, it is missing that on Windows Store Apps. However, there are a few reasons why this is the case: 1. That API (to check for expiration) is only available on Windows Store Apps, whereas on Windows Phone, you have to track it yourself (refer to http://stackoverflow.com/questions/19656893/windows-phone-8-trial-expiration-time). With this API we wanted to make it a consistent experience between Windows Store Apps and Windows Phone. 2. If you REALLY need access to that property on Windows Store Apps project, wrap your code #if NETFX_CORE/#endif and then just use Windows API: Code (csharp): #if NETFX_CORE <your code for Windows Store Apps> #endif Note: this won't work on anything else other than Windows Store Apps.
I have now written a time check which works with a test variable but how do i actually set the application to a trial? Windows.LicenseInformation.isOnAppTrial seems to return false always. Code (csharp): bool debugNoReg = false; if (LicenseInformation.isOnAppTrial | debugNoReg) { Debug.Log("Is trial version"); System.TimeSpan remainingTime = RemainingTrialTime (); if(remainingTime.TotalHours<0){ Debug.Log("Trial expired"); Application.LoadLevel("TrialExpired"); } } else { Debug.Log("Is full version"); //Do nothing ? } this is the other code i got that is supposed to handle the store bit in my TrialExpired scene : Code (csharp): if(closeButton.isHit){ Application.Quit(); } if(m_Receipt!=null m_Receipt.Length>0){ Application.LoadLevel("Title"); }else{ if (mainOkButton.GetComponent<ClickableValue>().isReleasedAndStillOver){ #if UNITY_METRO m_Receipt = LicenseInformation.PurchaseApp (); #endif } } However I am confused about this, if i override the is AppOnTrial with my debugNoReg boolean and run this as a package, I get a store box pop up with a simulated purchase which says return the strings: S_OK E_INVALIDREG E_FAIL E_OUTOFMEMORY However the Unity docs just says "returns a valid purchase reciept or empty if not purchased", and does not say anywhere about what to do with that reciept string, or how to then set the app to know it is "registered".
The app will know it's registered yourself. On Windows Store Apps it's calling this method under the hood with argument 'true': http://msdn.microsoft.com/en-us/library/windows/apps/hh967813.aspx
I have the same problem http://docs.unity3d.com/Documentation/ScriptReference/Windows.LicenseInformation-isOnAppTrial.html is always returning false to me, even after downloading my game on trial mode on store. What am I doing wrong?
LicenseInformation does not exists anymore on Unity Documentation. http://docs.unity3d.com/Documentation/ScriptReference/Windows.LicenseInformation-isOnAppTrial.html http://docs.unity3d.com/Documentation/ScriptReference/Windows.LicenseInformation.PurchaseApp.html All invalid links now! I still have problems detecting if my application is on Trial Mode or Not (it always return isOnAppTrial==false). The ES version is still online http://docs.unity3d.com/es/current/ScriptReference/Windows.LicenseInformation.html Please, anybody was able to make it work with Unity 5? Any official word on this, why it was removed from documentation? It does not works anymore? What should I use?
How are you testing it? Which platform is this on? Sorry about the documentation - looks like a documentation bug on our side.
I uploaded it to Windows Store. http://apps.microsoft.com/windows/e...relaxing/2109966f-88f2-465b-83e9-4b1253e8acac Please Download the Trial Version.... In the trial version, in Main Menu, you should view a Red "Buy Now" button instead of the Green "Visit Us" button. You can also press the 'Right Control Button', press it some times, and it will show the current return value of isOnAppTrial.
There is a problem with Prime31 Windows Store Plugiun, but with the Native Unity it worked now! Thanks for the Support...
Can I check with this that LicenseInformation.isOnAppTrial and LicenseInformation.PurchaseApp() both work on Windows Phone? I've just been bitten by WinBridge being Windows Store only and not communicating that very well, and whenever I read about LicenseInformation (bearing in mind the documentation is still down) I see phrases like "only works for Windows Store" that destroy my confidence that this is actually the solution for WP8. I could do with a solid yes or no, thanks
This function seems to crash when called from a IL2CPP UWP project. Is this supported still and is there anything special you need to do to use it? Crash exception: Unhandled exception at 0x00007FFFC627AE9C (GameAssembly.dll)
It should definitely work. Can we get a bug report on it? In the mean time, you could work around by calling the Windows API directly from your script: Code (csharp): static bool IsOnAppTrial() { #if ENABLE_WINMD_SUPPORT && UNITY_WSA return Windows.ApplicationModel.Store.CurrentApp.LicenseInformation.IsTrial; #else return false; #endif }
I added: using Windows.ApplicationModel.Store; But it says "the type or namespace 'Windows' could not be found", how do I add it?
Thanks I added the following and did a build: Code (CSharp): #if ENABLE_WINMD_SUPPORT && UNITY_WSA using Windows.ApplicationModel; using Windows.ApplicationModel.Store; #endif public bool IsTrialVersion() { #if ENABLE_WINMD_SUPPORT && UNITY_WSA return Windows.ApplicationModel.Store.CurrentAppSimulator.LicenseInformation.IsTrial; #else return false; #endif } But it now throws this error: BuildFailedException: Burst compiler (1.2.0-preview.9) failed running stdout: An unexpected exception occurred: stderr: Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null' at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters) at Burst.Compiler.IL.AssemblyLoader.Resolve(AssemblyNameReference name) at Mono.Cecil.MetadataResolver.Resolve(TypeReference type) at Mono.Cecil.TypeReference.Resolve() at Burst.Compiler.IL.Helpers.CecilExtensions.StrictResolve(TypeReference typeReference) at Burst.Bcl.BclApp.FindExecuteMethods(List`1 rootAssemblyPaths) at Burst.Bcl.BclApp.GetMethodsToCompileBeforeDynamicDispatch() at Burst.Bcl.BclApp.GetMethodsToCompile() at Burst.Bcl.Program.Main(String[] args) Running Unity 2019.2.10f1
I believe this is a known issue in burst that is being fixed. EDIT: this is fixed in Unity 2019.3 which should be out very soon.