LicenseInformation
LicenseInformation
LicenseInformation
LicenseInformation
Class
Definition
Provides access to the current app's license metadata.
public : sealed class LicenseInformation : ILicenseInformationpublic sealed class LicenseInformation : ILicenseInformationPublic NotInheritable Class LicenseInformation Implements ILicenseInformation// You can use this class in JavaScript.
- Attributes
| 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 DateTimeOffset// You can use this property in JavaScript.
- Value
- DateTime DateTimeOffset DateTimeOffset DateTimeOffset
The date and time that the app's trial license will expire.
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 : PlatForm::Boolean IsActive { get; }public bool IsActive { get; }Public ReadOnly Property IsActive As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean 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
Gets a value that indicates whether the license is a trial license.
public : PlatForm::Boolean IsTrial { get; }public bool IsTrial { get; }Public ReadOnly Property IsTrial As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
Returns true if the license is a trial license, and otherwise false.
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 IReadOnlyDictionary<string, ProductLicense> ProductLicenses { get; }Public ReadOnly Property ProductLicenses As IReadOnlyDictionary<string, ProductLicense>// You can use this property in JavaScript.
- Value
- IMapView<PlatForm::String, ProductLicense> IReadOnlyDictionary<string, ProductLicense> IReadOnlyDictionary<string, ProductLicense> IReadOnlyDictionary<string, ProductLicense>
The associative list of feature licenses.
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 LicenseChanged// You can use this event in JavaScript.
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.