new NFCTagReader()
This NFCTagReader class is responsible for handling the corresponding plugin js to interact with the * native NFCTagReader class. To set and get the properties, and to access the instance methods corresponding JS methods are written under this class which are used by the end user in application script.
Use the NFCTagReader object for Reading Tag and Verifying Document Security Object.
Methods
addDetectTagListener(successCallback, errorCallback, tagDetectedHandler)
A listener that will be called when tag was detected. This listener works for android only. For iOS * it won't work. It would notify about Tag Detection in tagDetectedHandler method.
Add this event listener before calling the readTag method.
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
function | Default Success Call back function name |
errorCallback |
function | Default Error Call back function name |
tagDetectedHandler |
function | This method won't return anything. This method will be called when tag will be detected. |
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.
tagDetectedHandler - This method won't return anything. It will be used to notify the user about tag detection.
successCallback - KMC_SUCCESS success call back.
errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception.
tagDetectedHandler - This method won't return anything. It will be used to notify the user about tag detection.
Example
function tagDetectedHandler()
{
alert("Tag Detected");
}
function successCallback(response){
alert(JSON.stringify(response));
}
function errorCallback(error){
alert(JSON.stringify(error));
}
var nfcTagReaderObject = kfxCordova.kfxEngine.createNFCTagReader();
nfcTagReaderObject.addTagDetectedListener(successCallback, errorCallback, tagDetectedHandler);
addDocumentSecurityObjectVerificationListener(successCallback, errorCallback, documentSecurityObjectVerificationHandler)
A listener that will be called when verification was done.
It would then send the status of the verification to documentSecurityObjectVerificationHandler method.
Add this event listener before calling the verifyDocumentSecurityObject method.
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
function | Default Success Call back function name |
errorCallback |
function | Default Error Call back function name |
documentSecurityObjectVerificationHandler |
function | This method will return boolean value which indicates that the verification is successful or not. |
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.
documentSecurityObjectVerificationHandler - This method will return boolean value which indicates that the verification is successful or not.
successCallback - KMC_SUCCESS success call back.
errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception.
documentSecurityObjectVerificationHandler - This method will return boolean value which indicates that the verification is successful or not.
Example
function documentSecurityObjectVerificationHandler(verificationSucceeded)
{
alert(JSON.stringify(verificationSucceeded));
}
function successCallback(response){
alert(JSON.stringify(response));
}
function errorCallback(error){
alert(JSON.stringify(error));
}
var nfcTagReaderObject = kfxCordova.kfxEngine.createNFCTagReader();
nfcTagReaderObject.addDocumentSecurityObjectVerificationListener(successCallback, errorCallback, documentSecurityObjectVerificationHandler);
addReadTagListener(successCallback, errorCallback, tagReadHandler)
A listener that will be called when tag was read.
It would send the NFCTagData object to success call back method.
Add this event listener before calling the radTag method.
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
function | Default Success Call back function name |
errorCallback |
function | Default Error Call back function name |
tagReadHandler |
function | A JSON object containing the properties of the NFC Tag Data object. Check the NFCTagData object for its properties. |
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.
tagReadHandler - will have the JSON object of the KFXTagData object properties.
successCallback - KMC_SUCCESS success call back.
errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception.
tagReadHandler - will have the JSON object of the KFXTagData object properties.
Example
function tagReadHandler(tagDetails)
{
alert(JSON.stringify(tagDetails));
}
function successCallback(response){
alert(JSON.stringify(response));
}
function errorCallback(error){
alert(JSON.stringify(error));
}
var nfcTagReaderObject = kfxCordova.kfxEngine.createNFCTagReader();
nfcTagReaderObject.addTagReadListener(successCallback, errorCallback, tagReadHandler);
readTag(successCallback, errorCallback, parameters)
Calling this method will start the Tag Read process. The event listener addReadTagListener will receive the delegate call back message and will have the corresponding tag details.
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
function | Default Success call back function name |
errorCallback |
function | Default Error call back function name |
parameters |
NFCTagParameters | Parameters which are required to read the tag. |
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 tag read process was successfully started for iOS and "OK" for Android.
errorCallback - KMC_EV_LICENSING The tag read process was not successfully started, and returns the licensing error code.Possible error objects are KmcRuntimeException,Exception.
successCallback - KMC_SUCCESS The tag read process was successfully started for iOS and "OK" for Android.
errorCallback - KMC_EV_LICENSING The tag read process was not successfully started, and returns the licensing error code.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(response){
alert(JSON.stringify(response));
}
function errorCallback(error){
alert(JSON.stringify(error));
}
var nfcTagReaderObject = kfxCordova.kfxEngine.createNFCTagReader();
nfcTagReaderObject.readTag(successCallback,errorCallback);
removeDetectTagListener(successCallback, errorCallback)
The method would remove the listener to the delegate call back of the readTag method.
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 'ErrorMs' & 'ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' function for successful operation.
Example
function successCallback(response){
alert(JSON.stringify(response));
}
function errorCallback(error){
alert(JSON.stringify(error));
}
var nfcTagReaderObject = kfxCordova.kfxEngine.createNFCTagReader();
// after verification done
nfcTagReaderObject.removeDetectTagListener(successCallback,errorCallback);
removeDocumentSecurityObjectVerificationListener(successCallback, errorCallback)
The method would remove the listener to the delegate call back of the verifyDocumentSecurity method.
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 'ErrorMs' & 'ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' function for successful operation.
Example
function successCallback(response){
alert(JSON.stringify(response));
}
function errorCallback(error){
alert(JSON.stringify(error));
}
var nfcTagReaderObject = kfxCordova.kfxEngine.createNFCTagReader();
// after verification done
nfcTagReaderObject.removeDocumentSecurityObjectVerificationListener(successCallback,errorCallback);
removeReadTagListener(successCallback, errorCallback)
The method would remove the listener to the delegate call back of the readTag method.
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 'ErrorMs' & 'ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' function for successful operation.
Example
function successCallback(response){
alert(JSON.stringify(response));
}
function errorCallback(error){
alert(JSON.stringify(error));
}
var nfcTagReaderObject = kfxCordova.kfxEngine.createNFCTagReader();
// after tag read
nfcTagReaderObject.removeReadTagListener(successCallback,errorCallback);
verifyDocumentSecurityObject(successCallback, errorCallback, parameters)
Calling this method will start the Verification process. The event listener addDocumentSecurityObjectVerificationListener will receive the delegate call back message and will have the corresponding Verification Status details.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
successCallback |
function | Default Success call back function name | ||||||||||||
errorCallback |
function | Default Error call back function name | ||||||||||||
parameters |
Object | Parameters to verify the Document Security Object.
Properties
|
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 tag read process was successfully started for iOS and "OK" for Android.
errorCallback - KMC_EV_LICENSING The tag read process was not successfully started, and returns the licensing error code.Possible error objects are KmcRuntimeException,Exception.
successCallback - KMC_SUCCESS The tag read process was successfully started for iOS and "OK" for Android.
errorCallback - KMC_EV_LICENSING The tag read process was not successfully started, and returns the licensing error code.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(response){
alert(JSON.stringify(response));
}
function errorCallback(error){
alert(JSON.stringify(error));
}
var nfcTagReaderObject = kfxCordova.kfxEngine.createNFCTagReader();
nfcTagReaderObject.verifyDocumentSecurityObject(successCallback,errorCallback);