> For the complete documentation index, see [llms.txt](https://pub-star.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pub-star.gitbook.io/docs/1.5.1/android-sdk/initialize.md).

# Initialize

### init(Context)

Initialization PubStar SDK. Initialization must be called once before loading or showing ads.

### Event

`InitAdListener`

| Callback  | Function                                                 |
| --------- | -------------------------------------------------------- |
| `onDone`  | call when PubStar SDK initializes successfully           |
| `onError` | call when load ad failed. return object type `ErrorCode` |

### Example

```kotlin

PubStarAdManager.getInstance()
    .setIsDebug(true)
    .setInitAdListener(object : InitAdListener {
        override fun onDone() {
            // callback when init done (ready to call load and show ad)
        }

        override fun onError(code: ErrorCode) {
            // callback when init error
        }
    }).init(context)
```
