Ir para o conteúdo

unbind()


Method used to terminate the connection with the service.

Method

Signature Description
void unbind(Context context) Performs the unbinding.

Parameter

Name Type Mandatory Description
context Context Yes The application context.

The method should be used if the bind() method has been called earlier, just so that it can terminate the service started by the bind.

Demonstration of unbind

Initialization

assets/images/Arquitetura

Payment

assets/images/Arquitetura

Reverse

assets/images/Arquitetura

Example of unbind
    @Override
    protected void onResume() {
        super.onResume();
        mPaymentClient.bind(this);
    }

    @Override
    protected void onPause() {
        try {
            mPaymentClient.unbind(this);
        } catch (Exception e) {
            Log.e(TAG, e.getMessage());
        }
        super.onPause();
    }

    @Override
    protected void onDestroy() {
        try {
            mPaymentClient.unbind(this);
        } catch (Exception e) {
            Log.e(TAG, e.getMessage());
        }
        super.onDestroy();
    }