Class: License

License()

new License()

Methods

acquireVolumeLicenses(successCallback, errorCallback, parameters)

The function is used to preallocate volume licenses for offline operation
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
parameters Object JSON object which contains license type, Number of volume license requested
Properties
Name Type Attributes Description
licenseFeatureType String <optional>
license type
licenseVolume Number <optional>
Number of licenses required
Example
var licenseType = LicObj.getLicenseTypes();
function successCallback(result){
  alert(JSON.stringify(result));
}
function errorCallback(error){
  alert(JSON.stringify(error));
}
var parameters = {
  licenseFeatureType: licenseType.ID_EXTRACTION,
  licenseVolume: 20
};

var LicObj = kfxCordova.kfxUtilities.createLicense();
LicObj.setMobileSDKLicenseServer(successCallback,errorCallback,LicenseStr);
LicObj.acquireVolumeLicenses(successCallback,errorCallback,parameters);

addAcquireVolumeLicenseListener(successCallback, errorCallback, acquireVolumeListenerCallBack)

This method would receive the volume of license allowed for offline operation and are captured in success call back.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error Call back function name
acquireVolumeListenerCallBack function a var to hold the licAcquired value returned from License
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. By Default, the error call back would return a JSON object with ErrorMsg & ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back. errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception. acquireVolumeListenerCallBack - will have the JSON object giving the volume of license allowed when the call is returned with no error.
Example
var LicObj = kfxCordova.kfxUtilities.createLicense();
function acquireVolumeListenerCallBack(licAcquired){
   alert(licAcquired);
}
function successCallback(result){
  alert(JSON.stringify(result));
}
function errorCallback(error){
  alert(JSON.stringify(error));
}
LicObj.addAcquireVolumeLicenseListener(successCallback,errorCallback,acquireVolumeListenerCallBack);

getDaysRemaining(successCallback, errorCallback)

Method to get the remaining days that the SDK license would be valid to use.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. Generally the error call back would return a JSON object with ErrorMsg & ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' function and will be having the number of days remaining in the current license for a valid license.
Example
function successCallback(result){
   alert(JSON.stringify(result));
}
function errorCallback(error){
   alert(JSON.stringify(error));
}

var LicObj = kfxCordova.kfxUtilities.createLicense();
var licenseString = 'pasteyourlicensestringhere!';
LicObj.setMobileSDKLicense(successCallback,errorCallback,licenseString);
LicObj.getDaysRemaining(successCallback,errorCallback);

getLicenseTypes()

Get the License supported LicenseTypes
Example
var LicObj = kfxCordova.kfxUtilities.createLicense();
var licenseTypes = LicObj.getLicenseTypes();
licenseTypes should be like below {
          IMAGE_CAPTURE       :  "IMAGE_CAPTURE",
          IMAGE_PROCESSING    :  "IMAGE_PROCESSING",
          BARCODE_CAPTURE     :   "BARCODE_CAPTURE",
          LOGISTICS           :  "LOGISTICS",
          ID_EXTRACTION       :  "ID_EXTRACTION"
  };

getRemainingVolumeCount(successCallback, errorCallback, licenseType)

The function will return available license count for the offline operation, application should
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
licenseType String for which the remaining license count is needed.
Example
var LicObj = kfxCordova.kfxUtilities.createLicense();
var licenseType = LicObj.getLicenseTypes();
var licenseString = 'pasteyourlicensestringhere!';
function successCallback(result){
  alert(JSON.stringify(result));
}
function errorCallback(error){
  alert(JSON.stringify(error));
}
LicObj.setMobileSDKLicenseServer(successCallback,errorCallback,licenseString);
LicObj.getRemainingVolumeCount(successCallback,errorCallback,licenseType.ID_EXTRACTION);

getSDKVersions(successCallback, errorCallback)

Method to get version string for the Kofax Mobile SDK as a whole. It also provides access to the version information of the Utility package and the Kofax Image Processor and Classifier libraries
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. Generally the error call back would return a JSON object with ErrorMsg & ErrorDesc' giving the description of the error.
Returns:
JSON object representing version string is returned in the 'successCallback' function.
Example
function successCallback(result){
      alert(JSON.stringify(result));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var LicObj = kfxCordova.kfxUtilities.createLicense();
var licenseString = 'pasteyourlicensestringhere!';
LicObj.setMobileSDKLicense(successCallback,errorCallback,licenseString);
LicObj.getSDKVersions(successCallback,errorCallback);

getServerTypes()

Get the License supported ServerTypes
Example
var LicObj = kfxCordova.kfxUtilities.createLicense();
 var serverTypes = LicObj.getServerTypes();
 serverTypes should be like below {
      RTTI            :  "RTTI",
      TOTALAGILITY    :  "TotalAgility"
  };

removeAcquireVolumeLicenseListener(successCallback, errorCallback)

The method would remove the listener to the delegate call back of the acquireVolumeLicenses method. After removing the listener, there will not be any call backs from native from the 'acquireVolumeLicenses' delegate methods even when it is being called in native.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error Call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(result){
  alert(JSON.stringify(result));
}
function errorCallback(error){
  alert(JSON.stringify(error));
}
var LicObj = kfxCordova.kfxUtilities.createLicense();
LicObj.removeAcquireVolumeLicenseListener(successCallback,errorCallback);

setMobileSDKLicense(successCallback, errorCallback, licenseString)

Method to set the License of the native SDK. The input to this method is the VRS license string. If the license string is valid and days remain in the license, this method returns KMC_SUCCESS . If the license string is valid but no days remain in the license, this method returns KMC_IP_LICENSE_EXPIRED. If the license string is not valid, this method returns KMC_IP_LICENSE_INVALID. Any failure to set the license would automatically set the daysRemaining to zero.The license can only be set once.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
licenseString String is the valid license string that was contained in a distributed header file that you received from Kofax.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS The license string was set successfully . errorCallback - KMC_IP_LICENSE_INVALID if the license string used is nil. KMC_IP_LICENSE_ALREADY_SET if you have already set the license. EVRS_IP_LICENSING_FAILURE if the license string is invalid for setting a license. EVRS_IP_LICENSE_EXPIRATION_ERROR if the time limit of your license has expired. Example code follows showing how to set your license.
Example
var licenseString = 'pasteyourlicensestringhere!';

function successCallback(result){
      alert(JSON.stringify(result));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}

var LicObj = kfxCordova.kfxUtilities.createLicense();
LicObj.setMobileSDKLicense(successCallback,errorCallback,licenseString);

setMobileSDKLicenseServer(successCallback, errorCallback, licenseParameters)

The function is used to setup the url string of license server used for on device operation licensing. Application must call this function before any on device operation that requires license
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
licenseParameters Object should be a valid url string of the on device operation licensing server and the server type.
Properties
Name Type Attributes Description
serverUrl String <optional>
a valid url string of the on device operation licensing server
serverType String <optional>
type of the server
Example
var LicObj = kfxCordova.kfxUtilities.createLicense();

 var serverType = LicObj.getServerTypes();
  var licenseParameters={
      serverUrl  : 'http://mobile-rtti/mobilesdk',
      serverType : serverType.RTTI
  }

function successCallback(result){
  alert(JSON.stringify(result));
}
function errorCallback(error){
  alert(JSON.stringify(error));
}

LicObj.setMobileSDKLicenseServer(successCallback,errorCallback,licenseParameters);