⚡
LootlyCasher SDK Documentation
Dashboard

🤖 Android Integration

Step 1: Add SDK to Your Project

Create a new file LootlyCasherSDK.kt in your project:

LOOTLYCASHERSDK.KT
package com.yourapp

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.util.Log

class LootlyCasher private constructor(private val context: Context) {
    private var apiKey: String = ""
    private var userId: String = ""
    private var deviceId: String = ""
    private var sandbox: Boolean = false

    companion object {
        private const val BASE_URL = "https://lootlycasher.online"
        private const val TAG = "LootlyCasher"
        @Volatile private var instance: LootlyCasher? = null
        fun getInstance(context: Context): LootlyCasher =
            instance ?: synchronized(this) {
                instance ?: LootlyCasher(context.applicationContext).also { instance = it }
            }
    }

    fun initialize(apiKey: String, userId: String, deviceId: String = "", sandbox: Boolean = false) {
        this.apiKey = apiKey
        this.userId = userId
        this.deviceId = deviceId
        this.sandbox = sandbox
        Log.d(TAG, "Initialized for user: $userId")
    }

    fun showOfferwall(activity: Activity) {
        val sandboxParam = if (sandbox) "&sandbox=1" else ""
        val url = "$BASE_URL/api/offerwall/$apiKey?user_id=$userId&device_id=$deviceId$sandboxParam"
        activity.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
    }
}

Step 2: Initialize & Show

KOTLIN
val sdk = LootlyCasher.getInstance(this)
sdk.initialize(apiKey = "YOUR_API_KEY", userId = "user_123")
sdk.showOfferwall(this)

Java Example

JAVA
LootlyCasher sdk = LootlyCasher.getInstance(this);
sdk.initialize("YOUR_API_KEY", "user_123", "", false);
sdk.showOfferwall(this);