activatePayment
Call the activatePayment API to activate the Host Card Emulation (HCE) payment function.
Method signature
void activatePayment(NFCActivateParams params, @Nullable ACResultCallback<Integer> callback);Request parameters
Item | Type | Description | Required |
params | HCE configurations. | No | |
callback | ACResultCallback<Integer> | The HCE activation result. For the result codes, see Result codes.
| No |
NFCActivateParams
Item | Type | Description | Default value | Required |
silentActivate | Boolean | Whether to process silent activation. Only used when isNeedConfirmActivate is set to |
| No |
replenishOnce | Boolean | Whether to automatically trigger a replenishment after successful card activation. |
| No |
doConfirm | Boolean | Whether the secondary confirmation is being processed. |
| No |
applyDebitToken | Boolean | Whether to apply for a debit token during activation. |
| No |
Result codes
The following table lists only the result values this API returns.
Code | SDK constant | HCE status |
|
| SDK is not connected. |
|
| Token status is unknown. |
|
| Failed to activate HCE. |
|
| HCE is activated successfully but Credentials are not obtained. Call the replenish API to obtain Credentials. |
|
| HCE is activated successfully and Credentials are obtained successfully. |
|
| Cannot execute activation as the token is locked. |
|
| Token status is not confirmed. |
Note: An activation already in progress is reported as result
0with errorCode10010(ACTIVATION_IN_PROGRESS). For the complete list of status codes and which APIs can return each value, see Token status.
Validation gates
The following conditions cause activatePayment to return immediately without making any network call.
Condition | Result | errorCode |
The SDK is not connected. |
|
|
silentActivate or doConfirm is set while isNeedConfirmActivate is |
|
|
No DeviceFingerPrintService is registered. |
|
|
The device fingerprint is empty or not exactly 64 characters. |
|
|
Response parameters
N/A
Sample
ACTapManager manager = ACTapManager.getInstance(this.getApplication());
manager.activatePayment(params, (result, errorCode, errorMsg) ->
log("Activation Result: " + result + " errorCode: " + errorCode + " errorMsg: " + errorMsg)
);