# 2. FSTT SDK features

## Init gateway

Contact us for get `app_id` & `secret_key`

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

```java
STTManager.initGateway("your_app_id", "your_secret_key", new IInitGatewayCallback() {
    @Override
    public void onSuccess() {

    }

    @Override
    public void onFail(@Nullable AppException error) {

    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```java
STTManager.initGateway(appId, secretKey, object : IInitGatewayCallback {
    override fun onSuccess() {
    
    }

    override fun onFail(error: AppException?) {

    }
})
```

{% endtab %}
{% endtabs %}

## Register SDK Callback

**After registration, the SDK will return the corresponding status in the callback**

| Status      | Description                                            |
| ----------- | ------------------------------------------------------ |
| onStart     | Called at start record                                 |
| onRecording | Called while in process recording                      |
| onSuccess   | Called when completed record process and return result |
| onFail      | Called when an error occurs in process recording       |

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

```java
STTManager.registerSTTCallback(new ISTTCallback() {
    @Override
    public void onStart() {
        
    }

    @Override
    public void onRecording() {

    }

    @Override
    public void onFail(@Nullable AppException error) {

    }

    @Override
    public void onSuccess(@NonNull String result) {

    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```java
STTManager.registerSTTCallback(object : ISTTCallback {
    override fun onStart() {

    }

    override fun onRecording() {
    
    }

    override fun onFail(error: AppException?) {

    }

    override fun onSuccess(result: String) {

    })
})
```

{% endtab %}
{% endtabs %}

## Start STT

* Used to start record for STT
* When successful start, the SDK starts entering the recording state, it will be called on `onStart()` in callback. Handling start record successfully here.
* When start record fails, it will be processed at callback `onFail()` in callback.

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

```java
STTManager.startSTT();
```

{% endtab %}

{% tab title="Kotlin" %}

```java
STTManager.startSTT()
```

{% endtab %}
{% endtabs %}

## Stop STT

* Used to stop record and process record to text result
* When successful, the SDK will be return text result on `onSuccess()` in callback. Handling stop record successfully here.
* When fails, it will be processed at callback `onFail()` in callback.

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

```java
STTManager.stopSTT();
```

{% endtab %}

{% tab title="Kotlin" %}

```java
STTManager.stopSTT()
```

{% endtab %}
{% endtabs %}


---

# 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://ftech.gitbook.io/fstt/android-fstt-sdk/2.-fstt-sdk-features.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.
