Need help upgrading to Ionic Framework 4.0? Get assistance with our Enterprise Migration Services EXPLORE NOW

hce

Improve this doc

HCE Cordova Wrapper

Repo: https://github.com/don/cordova-plugin-hce

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ''
    $ npm install --save @ionic-native/hce@4
    
  2. Add this plugin to your app's module

Supported platforms

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.

API

Native

General