Search code examples
c#windows-runtimewindows-store-appswindows-8.1

LicenseInformation IsTrial is always true, even after buying the app


I have published an app in Windows store, but it's hidden for the moment, so I could test.

There is a Trial in the app, giving you access to some level. I didn't put any time limit. When you buy the game, you should have access to all the levels. But the "IsTrial" is always true.

private static LicenseInformation _licenseInformation = CurrentApp.LicenseInformation;

public static bool IsLevelEnabled(LevelViewModel level)
{
#if DEBUG
  return true;
#else
  if (_licenseInformation.IsActive)
  {
    if (_licenseInformation.IsTrial) //Problem, always true
    {
      if ([...])//some logic to check is level is enabled in Trial.
      {
        return true;
      }
      else
      {
        return false;
      }
    }
    else //Should go here when you buy the app.
    {
      return true;
    }
  }
  else
  {
    return false;
  }
#endif
}

My code is base on https://msdn.microsoft.com/en-us/library/windows/apps/xaml/Dn532253(v=win.10).aspx.

Thanks

Edit

Someone else bought my app on the store, don't think he tried the trial. Everything is fine for him. He had access to all levels. And I'm still stuck in trial.


Solution

  • I tried on other computers and it was fine, so it's a problem with my account on one computer.

    So the code is ok.

    I could change the code like Nasser said and refresh the license each time, but it was not necessary for me.

    Still have the problem on one computer. Put I don't think i'll find the anwser in this code.