locked
Question about a trial conversion error condition.

    Question

  • In the following code from the Trial app and in-app purchase sample, in a live situation, what would cause the outcome to arrive at this line instead of a successful upgrade?

    rootPage->NotifyUser("You still have a trial license for this app.", NotifyType::ErrorMessage);

           

    create_task(CurrentAppSimulator::RequestAppPurchaseAsync(false)).then([this](task<Platform::String^> currentTask) 

    {              try              {                  currentTask.get();                  auto licenseInformation = CurrentAppSimulator::LicenseInformation;                  if (licenseInformation->IsActive && !licenseInformation->IsTrial)                  {                      rootPage->NotifyUser("You successfully upgraded your app to the fully-licensed version.", NotifyType::StatusMessage);                  }                  else                  {                      rootPage->NotifyUser("You still have a trial license for this app.", NotifyType::ErrorMessage);                  }              }              catch(Platform::Exception^ exception)              {                  rootPage->NotifyUser("The upgrade transaction failed. You still have a trial license for this app.", NotifyType::ErrorMessage);              }          }); 

    I mean if this happens, what information should I be giving the user, and in this situation have they made a successful purchase? Will the LicenseChangedEventHandler fire at some point in the future?


    • Edited by MrReapz Wednesday, November 07, 2012 11:21 PM Tried to edit
    Wednesday, November 07, 2012 11:20 PM

Answers

  • Hi,

    I'm not clear your point, do you mean that how the user to know if the license purchased successfully?

    If so, there is a LicenseChangedEventHandler event, when the license changed the event will fire.

    licenseInformation.LicenseChanged += new LicenseChangedEventHandler(licenseChangedEventHandler);

    For more information, please check this document .
    http://msdn.microsoft.com/en-us/library/windows/apps/hh694065.aspx

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us


    • Edited by Jesse Jiang Thursday, November 08, 2012 6:07 AM
    • Marked as answer by Jesse Jiang Friday, November 23, 2012 8:07 AM
    Thursday, November 08, 2012 6:07 AM
  • Hi,

    If the license information is not trial, the user cannot launch the app next time.

    •Trial license expires before the app is launched
     
    If the trial expires before the user launches the app, your app won't launch. Instead, users see a dialog box that gives them the option to purchase your app from the Store.

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Jesse Jiang Friday, November 23, 2012 8:07 AM
    Friday, November 09, 2012 7:12 AM

All replies

  • Hi,

    I'm not clear your point, do you mean that how the user to know if the license purchased successfully?

    If so, there is a LicenseChangedEventHandler event, when the license changed the event will fire.

    licenseInformation.LicenseChanged += new LicenseChangedEventHandler(licenseChangedEventHandler);

    For more information, please check this document .
    http://msdn.microsoft.com/en-us/library/windows/apps/hh694065.aspx

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us


    • Edited by Jesse Jiang Thursday, November 08, 2012 6:07 AM
    • Marked as answer by Jesse Jiang Friday, November 23, 2012 8:07 AM
    Thursday, November 08, 2012 6:07 AM
  • I understand and I am using the LicenseChangedEventHandler which works correctly. I am just a bit confused by the code from the sample which I've copied above. If the RequestAppPurchaseAsync completes without an exception, why would the trial still be in effect?
    Thursday, November 08, 2012 12:59 PM
  • Hi,

    If the license information is not trial, the user cannot launch the app next time.

    •Trial license expires before the app is launched
     
    If the trial expires before the user launches the app, your app won't launch. Instead, users see a dialog box that gives them the option to purchase your app from the Store.

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Jesse Jiang Friday, November 23, 2012 8:07 AM
    Friday, November 09, 2012 7:12 AM