Device.getVelocityLicenseInfo()
Overview
Gets information for all Velocity licenses on the device.
Added in version 2.1.40
Format
var licenses = Device.getVelocityLicenseInfo();
Parameter | Description | Type | Required | Notes |
---|---|---|---|---|
licenses | An array of license objects. | Array of Object | Return Type | An array of license objects is returned (See License objects below). May return undefined or null if there are no licenses on the device or if the device is using a demo license. |
License objects
Value | Description | Type |
---|---|---|
ExpirationDate | The date when the license will expire. The only valid properties of the ExpirationDate date object are Year, Month and Day. In a JavaScript Date object the number of the month is zero-based. For example: January = 0, December = 11 | Date |
SerialNumber | The serial number of the license. | String |
Licensee | Name associated with the license. | String |
Platform | Platform that the license is valid for. | String |
Type | The license type (TE, WEB, Oracle SIM, or Speakeasy). | String |
Example
Copy
/* Using the ExpirationDate and SerialNumber properties loop through the licences on the device and display a toast message showing the serial number and number of days left for the first licence to expire on the device.
*/
var licences = Device.getVelocityLicenseInfo();
if(licences.length > 0) {
var firstExpireDate;
var licSerial;
for (var i = 0; i < licences.length; i++) {
const diffInMs = licences[i].ExpirationDate - new Date();
const diffInDays = diffInMs / (1000 * 60 * 60 * 24);
if(Math.round(diffInDays) < firstExpireDate || i == 0) {
firstExpireDate = Math.round(diffInDays)
licSerial = licences[i].SerialNumber;
}
}
View.toast("License with Serial number " + licSerial + " will expire in " + firstExpireDate + " days", true);
}