hce
HCE Cordova Wrapper
Repo: https://github.com/don/cordova-plugin-hce
Installation
- Install the Cordova and Ionic Native plugins:
$ '' $ npm install --save @ionic-native/hce@4 - Add this plugin to your app's module
 
Supported platforms
- Android
 
Usage
import { hce } from '@ionic-native/hce';
constructor(private hce: hce) { }
...
function onCommand(command){
  var commandAsBytes = new Uint8Array(command);
  var commandAsString = hce.util.byteArrayToHexString(commandAsBytes);
  // do something with the command
  // send the response
  hce.sendReponse(commandResponse);
}
this.hce.registerCommandCallback().then(onCommand);
Instance Members
registerCommandCallback(onCommand, fail)
Registers command receiver.
| Param | Type | Details | 
|---|---|---|
| onCommand | 
      HCECommandEvent
     | 
    
       The event handler.  | 
  
| fail | 
      Function
     | 
    
       Error event handler.  | 
  
registerDeactivatedCallback(ok, fail)
Registers Deactivated receiver.
| Param | Type | Details | 
|---|---|---|
| ok | 
      HCEDeactivatedEvent
     | 
    
       Success event handler.  | 
  
| fail | 
      Function
     | 
    
       Error event handler.  | 
  
sendResponse(response, success, success)
Sends response APDU.
| Param | Type | Details | 
|---|---|---|
| response | 
      Uint8Array
     | 
    
       Response  | 
  
| success | 
      string
     | 
    
       Success Callback.  | 
  
| success | 
      string
     | 
    
       Failure Callback.  |