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

# SDK - Native

## Quick Start

> **Prerequisite:** Complete the [SDK Installation](/android/install-sdk.md) first. Minimum SDK version required: 1.2.1.

Native Campaigns lets you display a scrollable list of campaigns directly in your app's UI. The SDK provides a default layout — you just drop it in and call `load()`.

<figure><img src="/files/lZQWWLxArG2F8cHrVbXJ" alt=""><figcaption></figcaption></figure>

***

### **1. Set the Ad Unit ID**

After `Init`, set the ad unit ID for native campaigns:

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

```kotlin
MCOfferwallSDK.Init(this, "YOUR_API_KEY")
MCOfferwallSDK.SetUserId("YOUR_USER_ID")
MCOfferwallSDK.SetAdunitId("YOUR_AD_UNIT_ID")
```

{% endtab %}

{% tab title="Java" %}

```java
MCOfferwallSDK.Init(this, "YOUR_API_KEY");
MCOfferwallSDK.SetUserId("YOUR_USER_ID");
MCOfferwallSDK.SetAdunitId("YOUR_AD_UNIT_ID");
```

{% endtab %}
{% endtabs %}

> Get your Ad unit ID from the [Developer Portal](https://dashboard.maf.ad/).

### **2. Add the View to Your Layout**

In your layout XML, add the `MCNativeAdView`:

```xml
<io.mychips.nativesdk.view.MCNativeAdView
    android:id="@+id/mc_adView"
    android:layout_width="match_parent"
    android:layout_height="180dp" />
```

### **3. Load Campaigns**

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

```kotlin
import io.mychips.nativesdk.view.MCNativeAdView

val adView = findViewById<MCNativeAdView>(R.id.mc_adView)
adView.load()
```

{% endtab %}

{% tab title="Java" %}

```
import io.mychips.nativesdk.view.MCNativeAdView;

MCNativeAdView adView = findViewById(R.id.mc_adView);
adView.load();
```

{% endtab %}
{% endtabs %}

**That's it.** The SDK handles everything:

* Fetches campaigns from the API
* Shows a loading skeleton while fetching
* Displays campaigns in a horizontal scrollable list
* Tracks impressions automatically
* Opens the campaign detail page on click

***

### 4. (Optional) Open Campaign Details In-App

By default, tapping a campaign opens the detail page in the device's external browser. To keep users inside your app using an in-app WebView:

```java
MCOfferwallSDK.SetOpenInApp(true);
```

If you enable this, you must also register the WebView activity in your AndroidManifest.xml:

```xml
<activity android:name="io.mychips.offerwall.controller.MCOfferwallActivity"
            android:theme="@style/Theme.AppCompat.NoActionBar"/>
```

Since this is the activity defined in the [SDK - Offerwall](/android/sdk-offerwall.md), you can refer to its documentation if you want to set a title for it:

```java
MCOfferwallSDK.SetToolbarTitle("My Rewards");
```

### 5. What Happens Behind the Scenes

When you call `adView.load()`, the SDK:

1. Shows a **pulsing skeleton placeholder** that matches the layout direction
2. Calls the API to fetch campaigns
3. Replaces the skeleton with the **campaign list**
4. **Fires impression pixels** automatically when each campaign becomes visible
5. **Opens the campaign detail page** in the browser when the user taps a campaign

No manual tracking or click handling is needed.

***

### **Next Steps**

* Want to customize the look and feel with small effort? See [Customizations →](https://sites.gitbook.com/preview/site_KwL4X/~/revisions/BN8QqwKMZ6zGLtzh4VqC/android/sdk-native/sdk-native-custom-layout)
* Need a completely different card design? See [Custom Layouts →](https://sites.gitbook.com/preview/site_KwL4X/~/revisions/BN8QqwKMZ6zGLtzh4VqC/android/sdk-native/sdk-native-custom-layout)
* Need the full data reference? See [Data Reference →](https://sites.gitbook.com/preview/site_KwL4X/~/revisions/BN8QqwKMZ6zGLtzh4VqC/android/sdk-native/sdk-native-data-reference)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.mychips.io/android/sdk-native.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
