LicenseInformation LicenseInformation LicenseInformation LicenseInformation LicenseInformation Class


Provides access to the current app's license metadata.

public : sealed class LicenseInformation : ILicenseInformation
struct winrt::Windows::ApplicationModel::Store::LicenseInformation : ILicenseInformation
public sealed class LicenseInformation : ILicenseInformation
Public NotInheritable Class LicenseInformation Implements ILicenseInformation
// This class does not provide a public constructor.
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


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 Microsoft Store.


The CurrentApp object obtains its data from the Microsoft Store, which requires that you have a Microsoft Store developer account and that the app has been published in the Microsoft Store. If you don't have a Microsoft Store developer account, you can test the functions of this class by using the CurrentAppSimulator.


ExpirationDate ExpirationDate ExpirationDate ExpirationDate ExpirationDate

Gets the license expiration date and time relative to the system clock.

public : DateTime ExpirationDate { get; }
DateTime ExpirationDate();
public DateTimeOffset ExpirationDate { get; }
Public ReadOnly Property ExpirationDate As DateTimeOffset
var dateTimeOffset = licenseInformation.expirationDate;
DateTimeOffset DateTimeOffset DateTimeOffset

The date and time that the app's trial license will expire.


Windows Phone 8

This API always returns 9999 – 12 – 31 (ETERNITY_FILETIME_TIME).

IsActive IsActive IsActive IsActive IsActive

Gets a value that indicates whether the license is active.

public : Platform::Boolean IsActive { get; }
bool IsActive();
public bool IsActive { get; }
Public ReadOnly Property IsActive As bool
var bool = licenseInformation.isActive;
bool bool bool

Returns true if the license is active, and otherwise false. Returns false if the license is missing, expired, or revoked. See the remarks in IsTrial for more info.

IsTrial IsTrial IsTrial IsTrial IsTrial

Gets a value that indicates whether the license is a trial license.

public : Platform::Boolean IsTrial { get; }
bool IsTrial();
public bool IsTrial { get; }
Public ReadOnly Property IsTrial As bool
var bool = licenseInformation.isTrial;
bool bool bool

Returns true if the license is a trial license, and otherwise false.


For a trial experience with a trial period, there are some special considerations for interpreting the value of IsTrial. IsTrial returns true even after the trial period ends, because a trial license is logically considered to be a trial license both during and after the trial period. After purchase, when the license becomes full, IsTrial returns false. While IsTrial returns true, there are two ways to tell whether the trial period has expired. If you want to take action the moment the trial period expires then compare the current Coordinated Universal Time (or Zulu time) with ExpirationDate. Otherwise, you can check IsActive, which returns true during the trial period and false some time after the trial period ends.


Be aware that, for an app installed from the Microsoft Store, it can take some hours after the trial period ends for IsActive to begin returning a value of false. When testing your app with CurrentAppSimulator, IsActive will return false at the exact datetime set in the configuration file.

ProductLicenses ProductLicenses ProductLicenses ProductLicenses ProductLicenses

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

public : IMapView<Platform::String, ProductLicense> ProductLicenses { get; }
IMapView<winrt::hstring, ProductLicense> ProductLicenses();
public IReadOnlyDictionary<string, ProductLicense> ProductLicenses { get; }
Public ReadOnly Property ProductLicenses As IReadOnlyDictionary<string, ProductLicense>
var iReadOnlyDictionary = licenseInformation.productLicenses;
IReadOnlyDictionary<string, ProductLicense> IReadOnlyDictionary<string, ProductLicense> IReadOnlyDictionary<string, ProductLicense>

The associative list of feature licenses.


To determine if the user is entitled to the in-app products, use the IsActive property of the ProductLicense objects.


The returned list of ProductLicense objects will always represent all in-app products that the user is currently entitled to (where IsActive = true). However, this list may or may not also contain ProductLicense objects for products that the user is not currently entitled to (where IsActive = false).


LicenseChanged LicenseChanged LicenseChanged LicenseChanged LicenseChanged

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

public : event LicenseChangedEventHandler LicenseChanged<>
// Register
event_token LicenseChanged(LicenseChangedEventHandler<> const& handler) const;

// Revoke with event_token
void LicenseChanged(event_token const& cookie) const;

// Revoke with event_revoker
LicenseChanged_revoker LicenseChanged(auto_revoker_t, LicenseChangedEventHandler<> const& handler) const;
public event LicenseChangedEventHandler LicenseChanged<>
Public Event LicenseChangedEventHandler LicenseChanged( Of )
function onLicenseChanged(eventArgs){/* Your code */}

licenseInformation.addEventListener("licenseChanged", onLicenseChanged);
licenseInformation.removeEventListener("licenseChanged", onLicenseChanged);


LicenseChanged events aren't always immediate. If you’ve registered for the event, the event should fire within an hour; if not, it should occur within 6 hours. Generally, it's recommended to wait up to 6 hours when testing with CurrentApp, knowing that it will most likely take less time if the app has registered the event.

Windows Phone 8

This event is not raised on Windows Phone 8.

See Also