LicenseInformation class
Provides access to the current app's license metadata.
Syntax
/* For information about creating or accessing this object, see Remarks. */
Attributes
- MarshalingBehaviorAttribute(Agile)
- ThreadingAttribute(Both)
- VersionAttribute(NTDDI_WIN8)
Members
The LicenseInformation class has these types of members:
Events
The LicenseInformation class has these events.
| Event | Description |
|---|---|
| LicenseChanged | Raises a notification event when the status of the app's license changes. |
Methods
The LicenseInformation class inherits methods from the Object class (C#/VB/C++).
Properties
The LicenseInformation class has these properties.
| Property | Access type | Description |
|---|---|---|
| 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 the app's features that can be bought through an in-app purchase. |
Remarks
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.
Examples
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 current app object using the simulator interface currentApp = Windows.ApplicationModel.Store.CurrentAppSimulator; // get the license information object licenseInformation = currentApp.licenseInformation; // register license state change licenseInformation.addEventListener("licensechanged", reloadLicense);
Requirements
|
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 |
|
Namespace |
|
|
Metadata |
|
See also
- Trial app and in-app purchase sample
- How to create a trial version of your app
- How to support in-app purchases
Build date: 2/25/2013
