Packageair.system
Classpublic class License
InheritanceLicense Inheritance EventDispatcher Inheritance Object

Language version: ActionScript 3.0
Runtime version: AIR 51

The License class is used to provide information about the AIR SDK license, for a running application. This may include details that will be used by the runtime to determine whether or not certain features will be supported.

Note that this initially just loads in the information from a local file. If there is no local file then it is assumed this is a 'free tier' license. For some properties, such as the number of seats available to this developer ID, it is necessary to check the details online via the HARMAN servers. For this, you would need to first call checkDetailsOnline, and wait for the complete event before then checking the values. Default zero/null values will be returned until the relevant information has been successfully retrieved.

The goal is for an application running via ADL to be able to check the status of the local license, or for an installed application to be able to find out the relevant details. In order to prevent mis-use, if someone tried to take anyone else's developer ID and find out the details for this, this should not be possible due to the security checks that are implemented within this functionality.



Public Properties
 PropertyDefined by
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  creationDate : Date
[read-only] Date of creation of the license file (as embedded in the adt.lic file)
License
  developerID : String
[read-only] Developer ID for this license
License
  expiryDate : Date
[read-only] Expiry date of a license that was loaded from a file.
License
  isValid : Boolean
[read-only] Validity of the license.
License
  level : String
[read-only] Level of the license (enterprise/professional/basic/free)
License
  numberOfSeats : uint
[read-only] Number of developer seats for this licensee (only available after the details have been checked online).
License
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Public Methods
 MethodDefined by
  
Default constructor - do not call this directly, instead use one of the static methods such as load or loadFromFile.
License
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
  
Checks the license details online against the HARMAN licensing server.
License
 Inherited
Dispatches an event into the event flow.
EventDispatcher
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
  
[static] Load data from the default location for this application or user.
License
  
[static] Load data from a specific adt.lic file rather than pick up the application license.
License
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Events
 EventSummaryDefined by
 Inherited [broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
   Dispatched when the online license check has completed successfully.License
 Inherited [broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
   Dispatched when an input/output error occurs that causes the License.checkDetailsOneline() operation to fail.License
   Dispatched if a call to License.checkDetailsOnline() attempts to load data from a server outside the security sandbox.License
Public Constants
 ConstantDefined by
  BASIC : String = "basic"
[static] Definition for a Basic license level
License
  ENTERPRISE : String = "enterprise"
[static] Definition for an Enterprise license level
License
  FREE : String = "free"
[static] Definition for a Free Tier license level
License
  PROFESSIONAL : String = "professional"
[static] Definition for a Professional license level
License
Property detail
creationDateproperty
creationDate:Date  [read-only]

Date of creation of the license file (as embedded in the adt.lic file)

Implementation
    public function get creationDate():Date
developerIDproperty 
developerID:String  [read-only]

Developer ID for this license

Implementation
    public function get developerID():String
expiryDateproperty 
expiryDate:Date  [read-only]

Expiry date of a license that was loaded from a file.

Once the license has been checked online, this would give the developer's license expiry.

Implementation
    public function get expiryDate():Date
isValidproperty 
isValid:Boolean  [read-only]

Validity of the license. If the license is not valid, there is no developer ID, and the license level is assumed to be 'free'.

Implementation
    public function get isValid():Boolean
levelproperty 
level:String  [read-only]

Level of the license (enterprise/professional/basic/free)

Implementation
    public function get level():String
numberOfSeatsproperty 
numberOfSeats:uint  [read-only]

Number of developer seats for this licensee (only available after the details have been checked online).

Implementation
    public function get numberOfSeats():uint
Constructor detail
License()constructor
public function License()

Language version: ActionScript 3.0
Runtime version: AIR 51

Default constructor - do not call this directly, instead use one of the static methods such as load or loadFromFile.

Method detail
checkDetailsOnline()method
public function checkDetailsOnline():Boolean

Language version: ActionScript 3.0
Runtime version: AIR 51

Checks the license details online against the HARMAN licensing server.

When the license check is successfully completed, a complete event will be dispatched. Errors will be indicated by ioError or securityError.

Note that there must be a valid license file in place before this function can be called: if this is called when there is no valid developerID property, the function will return false.

Returns
Boolean
load()method 
public static function load():License

Load data from the default location for this application or user.

If the app is running via ADL, this looks for the user's developer license file (adt.lic), normally in the user's home folder. If the app is a deployed application then the license will be read from the generated license.txt file that should be within the installation folder.

Returns
License
loadFromFile()method 
public static function loadFromFile(license:File):License

Load data from a specific adt.lic file rather than pick up the application license.

Parameters
license:File

Returns
License
Event detail
completeevent 
Event object type: flash.events.Event
Event.type property = flash.events.Event.COMPLETE

Language version: ActionScript 3.0
Runtime version: AIR 51

Dispatched when the online license check has completed successfully.

The Event.COMPLETE constant defines the value of the type property of a complete event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe network object that has completed loading.
ioErrorevent  
Event object type: flash.events.IOErrorEvent
IOErrorEvent.type property = flash.events.IOErrorEvent.IO_ERROR

Language version: ActionScript 3.0
Runtime version: AIR 51

Dispatched when an input/output error occurs that causes the License.checkDetailsOneline() operation to fail.

Defines the value of the type property of an ioError event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
errorIDA reference number associated with the specific error (AIR only).
targetThe network object experiencing the input/output error.
textText to be displayed as an error message.
securityErrorevent  
Event object type: flash.events.SecurityErrorEvent
SecurityErrorEvent.type property = flash.events.SecurityErrorEvent.SECURITY_ERROR

Language version: ActionScript 3.0
Runtime version: AIR 51

Dispatched if a call to License.checkDetailsOnline() attempts to load data from a server outside the security sandbox.

The SecurityErrorEvent.SECURITY_ERROR constant defines the value of the type property of a securityError event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe network object reporting the security error.
textText to be displayed as an error message.
Constant detail
BASICconstant
public static const BASIC:String = "basic"

Definition for a Basic license level

ENTERPRISEconstant 
public static const ENTERPRISE:String = "enterprise"

Definition for an Enterprise license level

FREEconstant 
public static const FREE:String = "free"

Definition for a Free Tier license level

PROFESSIONALconstant 
public static const PROFESSIONAL:String = "professional"

Definition for a Professional license level