Provides access to the current app's license metadata.
The LicenseInformation class has these types of members:
The LicenseInformation class has these events.
|LicenseChanged||Raises a notification event when the status of the app's license changes.|
The LicenseInformation class has these properties.
|Read-only||Gets the license expiration date and time relative to the system clock.|
|Read-only||Gets the value that indicates whether the license is active.|
|Read-only||Gets the value that indicates whether the license is a trial license.|
|Read-only||Gets the associative list of licenses for in-app products that a user is currently entitled to.|
For app trial versions of an app, IsActive will return true so long as the trial hasn’t expired. During the trial period the IsTrial returns true; returning false when the customer upgrades to the full version of the app.
You access this object through the LicenseInformation property of the CurrentAppSimulator object during testing, or the LicenseInformation property of the CurrentApp object when the app is distributed through the Windows Store.
// get current app object using the simulator interface currentApp = Windows.ApplicationModel.Store.CurrentAppSimulator; // get the license information object licenseInformation = currentApp.licenseInformation;
Note The CurrentApp object obtains its data from the Windows Store, which requires that you have a Windows Store developer account and that the app has been published in the Windows Store. If you don't have a Windows Store developer account, you can test the functions of this class by using the CurrentAppSimulator.
The following example illustrates how to get a LicenseInformation object from the simulated version of the current app. The sample also shows adding an event listener to catch changes in the license's status while the app is running.
// get the license info for this app from the simulator licenseInformation = CurrentProductSimulator.LicenseInformation; // add event handler to catch changes in license state. licenseInformation.LicenseChanged += new LicenseChangedEventHandler(licenseChangedEventHandler);
Minimum supported client
|Windows 8 [Windows Store apps only]|
Minimum supported server
|Windows Server 2012 [Windows Store apps only]|
Minimum supported phone
|Windows Phone 8|
- Trial app and in-app purchase sample
- How to enable in-app purchases from your app
- The in-app purchase experience for a customer