> For the complete documentation index, see [llms.txt](https://docs.truecaller.com/truecaller-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.truecaller.com/truecaller-sdk/android/latest-oauth-sdk-3.3.0/integration-steps/initialisation.md).

# Initialisation

6. Create a TcSdkOptions object by using the tcOAuthCallback from the previous step and provide the context. Supply the appropriate customization settings to the relevant methods of TcSdkOptions and use the instance of tcSdkOptions to initialize the TcSdk in the next step.\
   Starting from SDK **v3.3.0**, the OAuth consent screen uses an enhanced bottom sheet UI by default. You can control this via `setEnhancedBottomSheetEnabled(boolean)` in your `TcSdkOptions`
   * `true` (default) — Shows the enhanced bottom sheet consent UI.\
     \&#xNAN;*For UI reference of the screens with enhanced bottomsheet, click* [*here*](/truecaller-sdk/android/latest-oauth-sdk-3.3.0/scenarios-for-all-user-verifications-truecaller-and-non-truecaller-users.md)<br>
   * `false` — Falls back to the old consent UI.\
     \&#xNAN;*For UI reference of the screens with old bottomsheet, click* [*here*](/truecaller-sdk/android/oauth-sdk-3.2.1/scenarios-for-all-user-verifications-truecaller-and-non-truecaller-users.md)

<pre><code>val tcSdkOptions = TcSdkOptions.Builder(this, tcOAuthCallback)
.buttonColor(Color.parseColor("&#x3C;&#x3C;VALID_COLOR_HEX_CODE>>"))
          .buttonTextColor(Color.parseColor("&#x3C;&#x3C;VALID_COLOR_HEX_CODE>>"))
            .loginTextPrefix(TcSdkOptions.LOGIN_TEXT_PREFIX_TO_GET_STARTED)
            .ctaText(TcSdkOptions.CTA_TEXT_CONTINUE)
            .buttonShapeOptions(TcSdkOptions.BUTTON_SHAPE_ROUNDED)
            .footerType(TcSdkOptions.FOOTER_TYPE_SKIP)
            .consentTitleOption(TcSdkOptions.SDK_CONSENT_TITLE_LOG_IN)
            .sdkOptions(TcSdkOptions.OPTION_VERIFY_ONLY_TC_USERS)
            .setEnhancedBottomSheetEnabled(true) 
<strong>            .build();
</strong></code></pre>

In case you do not wish to provide any customization settings and fall back to the default SDK settings, you may simply call -

```
val tcSdkOptions = TcSdkOptions.Builder(this, tcOAuthCallback).build()
```

7. Initialize TcSdk using the tcSdkOptions from the previous step :

```
TcSdk.initAsync(tcSdkOptions)
```

Note: Truecaller OAuth SDK needs to be initialized only once in the component and the same instance can be accessed without the need to initialize it again, via **TcSdk.getInstance()**

Ideally, you should call the initAsync() method when the component is getting created/initialized to avoid calling it multiple times.

\
Use `initAsync(TcSdkOption)` to initialise the SDK on a background thread, keeping your UI responsive. A `TcOAuthCallback` notifies you when initialization completes:

* `onSdkReady()` — SDK is initialized and ready to use.
* `onFailure()` — Initialization failed (e.g., OAuth flow is unavailable).

**Important:** Always call `TcSdk.clear()` before `initAsync()` when re-initializing from a different Activity or with a new callback. This ensures the callback is delivered to the correct listener. If `initAsync` returns a failure, clear the SDK and retry.<br>

The SDK init should always happen in a background thread. You can refer to an example snippet below <sub>\[Recommended]</sub> :&#x20;

<pre><code>launch {
  withContext(Dispatchers.IO) {
     TcSdk.initAsync(tcSdkOptions)
<strong>   }
</strong>// Now can access TcSdk.getInstance()
}
</code></pre>

8. Once the SDK is initialized, check whether the OAuth functionality is usable or not by calling :

```
val isUsable = TcSdk.getInstance().isOAuthFlowUsable
```

If *isUsable* is True, you can proceed with further steps, otherwise, you’d have to fall back to some other mechanism ( your fallback verification flow ). Calling other SDK methods when isUsable is False would result in an exception, so please ensure to call this soon after initializing the SDK, and proceed to further steps only if this method returns True.
