Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

LicenseInformation class

Applies to Windows and Windows Phone

Provides access to the current app's license metadata.

Syntax


/* For information about creating or accessing this object, see Remarks. */

Attributes

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]

Members

The LicenseInformation class has these types of members:

Events

The LicenseInformation class has these events.

EventDescription
LicenseChanged Raises a notification event when the status of the app's license changes.

 

Properties

The LicenseInformation class has these properties.

PropertyAccess typeDescription

ExpirationDate

Read-onlyGets the license expiration date and time relative to the system clock.

IsActive

Read-onlyGets a value that indicates whether the license is active.

IsTrial

Read-onlyGets a value that indicates whether the license is a trial license.

ProductLicenses

Read-onlyGets the associative list of licenses for in-app products that a user is currently entitled to.

 

Remarks

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.

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

Windows.ApplicationModel.Store
Windows::ApplicationModel::Store [C++]

Metadata

Windows.winmd

See also

Trial app and in-app purchase sample
How to enable in-app purchases from your app
The in-app purchase experience for a customer

 

 

Show:
© 2014 Microsoft