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. | Optional | |
callback | ACResultCallback<Integer> | The HCE activation result. For the result codes, see Result codes. | Optional |
NFCActivateParams
Item | Type | Description | Required | Default value |
silentActivate | Boolean | Whether to process silent activation. Only used when isNeedConfirmActivate is set to | Optional | false |
replenishOnce | Boolean | Whether to automatically trigger a replenishment after successful card activation. | Optional | true |
doConfirm | Boolean | Whether the secondary confirmation is being processed. | Optional | false |
Result codes
Code | SDK constant | HCE status |
-3 | TOKEN_WB_UNAVAILABLE | White box is crashed. |
-2 | TOKEN_NOT_CONNECTED | SDK is not connected. |
-1 | TOKEN_STATUS_UNKNOWN | Token status is unknown. |
0 | TOKEN_STATUS_NOT_EXIST | Failed to activate HCE. |
1 | TOKEN_STATUS_ACTIVATED_WITH_NO_CREDENTIALS | HCE is activated successfully but Credentials are not obtained. Call the replenish API to obtain Credentials. |
2 | TOKEN_STATUS_READY_TO_TAP | HCE is activated successfully and Credentials are obtained successfully. |
3 | TOKEN_STATUS_LOCKED | Cannot execute activation as the token is locked. |
4 | TOKEN_STATUS_LOCAL_LOCK | Cannot execute activation as the token is locked locally. |
11 | TOKEN_STATUS_IN_PROGRESS | Activation is in progress. |
21 | TOKEN_STATUS_NOT_CONFIRMED | Token status is not confirmed. |
Response parameters
N/A
Sample
manager = ACTapManager.getInstance(this.getApplication())
manager.activatePayment(params, (result, errorCode, errorMsg) ->
log("Activation Result:" + result + " errorCode:" + errorCode + " errorMsg:" + errorMsg)
);