Ionic Framework 4 is almost here. Preview the beta docs and try it out now! Try Ionic 4 Beta

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
    
  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