Game Slot Android SDK Integration Guide

Updated: 2026-05-09

This document is for Android app integrators. It explains MiniGame Game Slot Android SDK dependencies, initialization, component integration, and test parameters.

Attachment:

  • AAR package and Demo APK.

1. Integration Requirements

1.1 Dependencies

Place the SDK AAR in the host project's libs directory, then add the following dependencies in the app module:

dependencies {
    implementation(files("libs/unite-sdk-1.0.1.aar"))

    // SDK dependencies required by the host app.
    implementation("com.squareup.okhttp3:okhttp:4.12.0")
    implementation("com.google.code.gson:gson:2.10.1")
    implementation("androidx.browser:browser:1.8.0")
    implementation("io.coil-kt:coil:2.6.0")
    implementation("io.coil-kt:coil-svg:2.6.0")
    implementation("androidx.media3:media3-exoplayer:1.4.1")
    implementation("androidx.media3:media3-ui:1.4.1")
    implementation("androidx.appcompat:appcompat:1.6.1")
    implementation("com.google.android.material:material:1.9.0")
}

1.2 Permissions

Declare network permissions in the host app's AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

2. Project Integration

2.1 Initialization Parameters

Production initialization parameters are obtained from the merchant platform or the MiniGame contact. The following parameters can be used for test environment debugging:

ParameterTest Value
client_id233802991579168768
api_key5e567421-c0a5-4723-80a6-2f5567517146

api_key corresponds to secretKey in the initialization method.

ParameterTypeDescription
contextContextApplication Context
clientIdStringClient ID assigned by operations
secretKeyStringSecret assigned by operations
appIdStringApp package name
uidStringUnique user identifier
appVersionStringApp version

2.2 Initialization and Component Integration Example

Initialize the SDK in the first Activity that hosts a game slot or during the app initialization flow. The environment can be set to DEV or PROD; if not set, it defaults to PROD.

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.unite.sdk.GameSlotSdk
import com.unite.sdk.slot.SlotListener
import com.unite.sdk.slot.GameSlot
import com.unite.sdk.view.BigCardView
import com.unite.sdk.view.BigVideoView
import com.unite.sdk.view.ThreeCardsView

class MainActivity : AppCompatActivity(), SlotListener {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        // Initialize the SDK.
        GameSlotSdk.setEnvironment(GameSlotSdk.Environment.PROD)
        GameSlotSdk.init(
            applicationContext,
            "YOUR_CLIENT_ID",
            "YOUR_SECRET_KEY",
            "YOUR_APP_ID",
            "USER_ID",
            "1.0.0"
        )

        // Load BigCardView.
        val bigCardView = findViewById<BigCardView>(R.id.bigCardView)
        bigCardView.setSlotListener(this)
        bigCardView.loadSlot("YOUR_SLOT_ID")

        // Load BigVideoView.
        val bigVideoView = findViewById<BigVideoView>(R.id.bigVideoView)
        bigVideoView.setSlotListener(this)
        bigVideoView.loadSlot("YOUR_SLOT_ID")

        // Load ThreeCardsView.
        val threeCardsView = findViewById<ThreeCardsView>(R.id.threeCardsView)
        threeCardsView.setSlotListener(this)
        threeCardsView.loadSlot(
            "YOUR_SLOT_ID",
            3,
            ThreeCardsView.CardStyle.NORMAL_VERTICAL188
        )
    }

    override fun onSlotLoaded(gs: GameSlot, slotId: String) {}

    override fun onSlotFailed(message: String, slotId: String) {}

    override fun onSlotShow(gs: GameSlot, slotId: String) {}

    override fun onSlotClick(gs: GameSlot, slotId: String) {}

    override fun onGameStart(gs: GameSlot) {}

    override fun onGameClose(gs: GameSlot) {}
}

3. Game Slot Integration

3.1 BigCardView

BigCardView is used for displaying a single large-card game slot. The component handles click behavior and reports clicks when the user taps the card or button before opening the game.

Test slot_id:

ComponentTest slot_id
BigCardViewTSZ3R9W6P2K8

XML layout:

<com.unite.sdk.view.BigCardView
    android:id="@+id/bigCardView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

Code integration:

val bigCardView = findViewById<BigCardView>(R.id.bigCardView)
bigCardView.setSlotListener(listener)
bigCardView.loadSlot("SLOT_ID")

3.2 BigVideoView

BigVideoView is used for game slots with video display capabilities. Make sure the host project has included the required androidx.media3 dependencies.

Test slot_id:

ComponentTest slot_id
BigVideoViewTSB4F2H8Y3Q7

XML layout:

<com.unite.sdk.view.BigVideoView
    android:id="@+id/bigVideoView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

Code integration:

val bigVideoView = findViewById<BigVideoView>(R.id.bigVideoView)
bigVideoView.setSlotListener(listener)
bigVideoView.loadSlot("YOUR_SLOT_ID")

3.3 ThreeCardsView

ThreeCardsView is used for scenarios where multiple game cards are displayed at once. You can specify the display count and card style during integration.

Test slot_id:

ComponentTest slot_id
ThreeCardsViewTSK9P4X1Q6B2

XML layout:

<com.unite.sdk.view.ThreeCardsView
    android:id="@+id/threeCardsView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

Code integration:

val threeCardsView = findViewById<ThreeCardsView>(R.id.threeCardsView)
threeCardsView.setSlotListener(listener)
threeCardsView.loadSlot(
    "YOUR_SLOT_ID",
    3,
    ThreeCardsView.CardStyle.NORMAL_VERTICAL188
)

4. Callback Reference

The host app can use SlotListener to listen for game slot loading, display, click, and game open or close events:

CallbackTrigger
onSlotLoaded(gs: GameSlot, slotId: String)Game slot loaded successfully
onSlotFailed(message: String, slotId: String)Game slot failed to load
onSlotShow(gs: GameSlot, slotId: String)Game slot displayed
onSlotClick(gs: GameSlot, slotId: String)User clicked the game slot
onGameStart(gs: GameSlot)Game starts opening
onGameClose(gs: GameSlot)Game closed

5. Integration Notes

  • SDK initialization must happen before calling component loadSlot.

  • clientId, secretKey, and slot_id must be isolated between test and production environments.

  • If the component already handles basic exposure and click flows, the host app should not report the same component again.

  • The video component depends on Media3. If the host project already uses a different version, watch for dependency conflicts.

  • Before production launch, verify offline, weak network, API failure, game open failure, and page destruction scenarios.

Business Development
Business Development
Official Account
Official Account