1. Implement HCE service
Overview
SDK integration
Extend AsyncHCEService
AsyncHCEServicepublic class MyHCEService extends AsyncHCEService {
// Overriding 'processCommandApdu' is optional
// Digital wallet application can capture APDU processing time.
@Override
public byte[] processCommandApdu(byte[] inputApdu, Bundle bundle) {
// Return the SDK value (always 'null').
// APDU processing is asynchronous.
// The SDK automatically sends response APDU to the POS terminal.
return super.processCommandApdu(inputApdu, bundle);
}
// Overriding 'onApduResponse' is optional
// Digital wallet application can inspect or override the response APDU.
@Override
public boolean onApduResponse(final byte[] inputApdu, final Bundle extras, final byte[] responseApdu){
// Digital wallet application can log responseApdu.
// If you want to override the response and reply to the POS terminal:
// 1. modify the responseAPDU
// 2. sendResponseApdu(modifiedResponseApdu);
// 3. return true; it tells the SDK the response is already sent.
// Otherwise, return false and let the SDK send responseApdu.
return false;
}
}Register the service in AndroidManifest.xml
AndroidManifest.xmlDeclare supported AIDs
Verify Tap and Pay settings

Last updated
Was this helpful?