# Native

Load and immediately show an Native ads by ID.

### Event

`AdLoaderListener` `AdShowedListener`

### Example

```kotlin
val pubStarAdController by lazy {
    PubStarAdManager.getAdController()
}

val adShowListener = object : AdShowedListener {
    override fun onAdShowed() {
        // callback when ad showed
    }

    override fun onAdHide(any: RewardModel?) {
        // callback when ad hide with reward option
    }

    override fun onError(code: ErrorCode) {
        // callback when error
    }
}

val adLoaderListener = object : AdLoaderListener {
    override fun onLoaded() {
        // callback when ad loaded
    }

    override fun onError(code: ErrorCode) {
        // callback when ad load code
    }
}       

val requestNative = NativeAdRequest.Builder(context)
    .sizeType(NativeAdRequest.Type.Big) // change size of native has "Big" , "Medium" ,"Small"
    .colorCTA(ResourcesCompat.getColor(resources,R.color.purple_200,null)) // change color loading & button CTA
    .backgroundResource(ResourcesCompat.getDrawable(resources,R.drawable.custom_bg_color,null)) // change color background
    .withView(view) 
    .adLoaderListener(adLoaderListener)
    .adShowedListener(adShowListener)
    .build()

  
pubStarAdController.loadAndShow("id", requestNative)       
```


---

# 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://pub-star.gitbook.io/docs/1.3.1/android-sdk/native.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.
