Ir para o conteúdo

bind()


Method used to connect to SDK services.

Method

Signature Description
void bind(Context context, Client.OnConnectionCallback callback) Performs binding and returns success or error callback

Parameter

Name Type Mandatory Description
context Context Yes Context of the application.
callback Client.OnConnectionCallback Yes Interface that will be run for success or error notifications of the payment process.

callback

Name Type Mantatory Description
onConnected Method for notification in case of connection.
onDisconnected Method for notification in case of Disconnected.

Warning

The PaymentClient.Bind(Context context, Client.OnConnectionCallback callback) method must be called before calling any payment integration method. bind is asynchronous, that is, the next line after bind() will be executed before receiving its response, so make sure that before calling integration methods, bind is connected.

Demonstration of bind

Initialization

assets/images/Arquitetura

Payment

assets/images/Arquitetura

Reverse

assets/images/Arquitetura

Example of bind
    public boolean bind(Context context, Client.OnConnectionCallback callback) {
        this.mConnectionCallback = callback;
        return this.internalBind(context);
    }

    public boolean bind(Context context) {
        return this.internalBind(context);
    }

    private boolean internalBind(Context context) {
        if (this.isBound()) {
            this.dispatchOnConnectedCallback();
            return true;
        } else {
            return this.mBinder.bind(context, this);
        }
    }