LicenseInformation LicenseInformation LicenseInformation LicenseInformation Class

Definition

Provides access to the current app's license metadata.

public sealed class LicenseInformationpublic sealed class LicenseInformationPublic NotInheritable Class LicenseInformationpublic sealed class LicenseInformation
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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.

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.

Properties

ExpirationDate ExpirationDate ExpirationDate ExpirationDate

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

public DateTime ExpirationDate { get; }public DateTimeOffset ExpirationDate { get; }Public ReadOnly Property ExpirationDate As DateTimeOffsetpublic DateTime ExpirationDate { get; }
Value
DateTime DateTime DateTime DateTime

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

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Windows Phone 8

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

IsActive IsActive IsActive IsActive

Gets a value that indicates whether the license is active.

public bool IsActive { get; }public bool IsActive { get; }Public ReadOnly Property IsActive As boolpublic bool IsActive { get; }
Value
bool 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.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

IsTrial IsTrial IsTrial IsTrial

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

public bool IsTrial { get; }public bool IsTrial { get; }Public ReadOnly Property IsTrial As boolpublic bool IsTrial { get; }
Value
bool bool bool bool

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

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

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.

Note

Be aware that, for an app installed from the Windows 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

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

public IMapView<string, ProductLicense> ProductLicenses { get; }public IMapView<string, ProductLicense> ProductLicenses { get; }Public ReadOnly Property ProductLicenses As IMapView<string, ProductLicense>public IMapView<string, ProductLicense> ProductLicenses { get; }
Value

The associative list of feature licenses.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

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

Important

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).

Events

LicenseChanged LicenseChanged LicenseChanged LicenseChanged

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

public event LicenseChangedEventHandler LicenseChangedpublic event LicenseChangedEventHandler LicenseChangedPublic Event LicenseChangedpublic event LicenseChangedEventHandler LicenseChanged
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

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.