# Khởi tạo SDK

## Omi SDK usages

### Thông tin tài khoản cần cung cấp cho SDK <a href="#user-content-account-informations-for-initialize-sdk" id="user-content-account-informations-for-initialize-sdk"></a>

Mỗi tài khoản thực hiện cuộc gọi trong OMI là tài khoản tổng đài của nhân viên, tài khoản này dùng để đăng nhập vào hệ thống tổng đài gồm các thông tin

* User name : Tên đăng nhập
* Password : Mật khẩu
* Realm : Domain của doanh nghiệp , domain này khi đăng ký và đăng nhập trên Web sẽ hiện thị đường dẫn có domain như sau:&#x20;

![](https://3454047468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LukDt3aTxo8xMLonIwO%2Fuploads%2FcxTEvRY6B3kt1wvBC7Wm%2Fimage.png?alt=media\&token=29c56b4a-1d6c-446a-91bd-a496ba7bbde7)

* customUI: Dùng để tuỳ chỉnh màn hình thoại đến và đi

Khởi tạo Omi SDK bằng cách thêm đoạn mã sau vào trong MainActivity của Project

```java
OmiClient(requireContext()).register(
    userName,
    password,
    realm,
    customUI = true
)
OmiSDKUtils.startOmiService(requireActivity())
```

### Xử lý kết quả trả về khi xin các quyền cần thiết  <a href="#user-content-handle-permissions-result" id="user-content-handle-permissions-result"></a>

Use OmiSDKUtils to handle permissions results

```java
override fun onRequestPermissionsResult(
        requestCode: Int,
        permissions: Array<out String>,
        grantResults: IntArray
) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults)
    OmiSDKUtils.handlePermissionRequest(requestCode, permissions, grantResults, requireActivity())
}
```

### &#x20;<a href="#user-content-listeners" id="user-content-listeners"></a>


---

# 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://api.omicall.com/sdk/mobile-sdk/android-sdk/khoi-tao-sdk.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.
