Alipay+ DocsAlipay+ Docs

connect

Call the connect API to connect to the SDK secure wallet.

Method signature

copy
boolean connect(String id, @Nullable ACResultCallback<Boolean> callback);

Request parameters

Item

Type

Description

Required

id

String

The ID that is used internally by the SDK for user isolation.

The SDK recognizes identical IDs passed in by the Mobile Payment Provider (MPP) through the connect API as the same user.

The SDK will not persistently store the ID.

Avoid using the original MPP user ID (UID).

Required

callback

ACResultCallback

Callback mechanism for handling scenarios with extended connection times.

If not specified, no callback occurs.

Optional

Response parameters

Item

Type

Description

Required

result

Boolean

Whether it is successfully connected.

Callback does not affect the result.

Required

Sample

copy
boolean result = manager.connect(currentUid, (result, errorCode, errorMsg) -> {
    if (result) {
        log("Connect success");
    } else {
        log("Connect failed");
    }
});