# SDK Connect

### Initialize

1. Add Gradle dependency by adding the following code to your Android App `build.gradle`

```
dependencies {
implementation "io.streampay:streampay-connect:0.0.13"
}
```

2\.  Create a single instance of Stream**Pay object** `context` wherever you need

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
val streampay = StreamPay(this, AuthenticationData.UserEnter, Locale.getDefault(), Environments.SANDBOX)
```

{% endtab %}

{% tab title="Java" %}

```
streamPay = new NearPay(this, AuthenticationData.UserEnter.INSTANCE, Locale.getDefault(), Environments.SANDBOX);
```

{% endtab %}
{% endtabs %}

3\. Create Stream**Pay** connect object and add Stream**Pay object** to it

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
val streampayConnect = StreampayConnect(this,streamPay)
```

{% endtab %}

{% tab title="Java" %}

```java
streampayConnect = new StreampayConnect(this,streamPay);a
```

{% endtab %}
{% endtabs %}

### Show()

show(): display a view with the current state and the option to connect with two different methods (Bluetooth and WebSocket) and disconnect.

```
streampayConnect.show();
```

### Disconnect()

* disconnect(): return true if there is a session to disconnect or attempt to new connect to stop. return false otherwise.

```
streampayConnect.disconnect()
```

### getSession(): &#x20;

* getSession(): return current session or null.

```
streampayConnect.getSession()
```

Find session data [here](https://streampay.gitbook.io/streampos/remote-integration/broken-reference)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://streampay.gitbook.io/streampos/remote-integration/sdk-connect.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
