Login Sign Up
Home Blog Integrating Gaintwall SDK: A Step-by-Ste...
Technical

Integrating Gaintwall SDK: A Step-by-Step Technical Guide

Feb 14, 2025 12 min read 50 views

Get Gaintwall integrated into your app quickly with this comprehensive technical guide.

Prerequisites

  • Active Gaintwall publisher account
  • API credentials (App ID and Secret Key)
  • Minimum SDK requirements: iOS 12.0+, Android API 21+, Unity 2019.4+

Installation

iOS (CocoaPods)

# Add to Podfile
pod 'GaintwallSDK', '~> 2.0'

# Install
pod install

Android (Gradle)

// Add to build.gradle (app level)
dependencies {
    implementation 'com.Gaintwall:Gaintwall:2.0.0'
}

Unity

  1. Download the Unity package from your dashboard
  2. Import it into your Unity project
  3. Configure settings in the Gaintwall prefab

Basic Configuration

iOS (Swift)

import GaintwallSDK

func application(_ application: UIApplication,
                didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

    Gaintwall.configure(
        appId: "YOUR_APP_ID",
        secretKey: "YOUR_SECRET_KEY"
    )

    return true
}

Android (Kotlin)

import com.Gaintwall.Gaintwall.Gaintwall

class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()

        Gaintwall.configure(
            context = this,
            appId = "YOUR_APP_ID",
            secretKey = "YOUR_SECRET_KEY"
        )
    }
}

Displaying the Offerwall

iOS

Gaintwall.show(
    from: viewController,
    userId: "user123",
    completion: { result in
        switch result {
        case .success:
            print("Offerwall displayed")
        case .failure(let error):
            print("Error: \(error)")
        }
    }
)

Android

Gaintwall.show(
    activity = this,
    userId = "user123",
    listener = object : GaintwallListener {
        override fun onShow() {
            Log.d("Gaintwall", "Displayed")
        }

        override fun onError(error: GaintwallError) {
            Log.e("Gaintwall", "Error: $error")
        }
    }
)

Reward Callbacks

Server-to-Server (Recommended)

Set up a webhook endpoint to receive reward notifications:

{
  "user_id": "user123",
  "offer_id": "offer456",
  "reward_amount": 100,
  "currency": "coins",
  "timestamp": 1640000000,
  "signature": "abc123..."
}

Client-Side

Gaintwall.setRewardListener { reward in
    print("User earned: \(reward.amount) \(reward.currency)")
    // Credit user account
}

Advanced Features

Custom Styling

let config = GaintwallConfig()
config.primaryColor = UIColor.purple
config.accentColor = UIColor.pink
config.navigationBarStyle = .dark

Gaintwall.setConfig(config)

Analytics Events

Gaintwall.setAnalyticsListener(object : AnalyticsListener {
    override fun onOfferClick(offerId: String) {
        // Track offer engagement
    }

    override fun onOfferComplete(offerId: String) {
        // Track conversions
    }
})

Testing

  1. Enable test mode during development: Gaintwall.setTestMode(true)
  2. Verify test rewards appear in your dashboard
  3. Test all user flows thoroughly before production release

Best Practices

  • ✅ Implement S2S callbacks for reward verification
  • ✅ Handle errors gracefully with user-friendly messaging
  • ✅ Cache user data appropriately to reduce latency
  • ✅ Test thoroughly on real devices before launch
  • ✅ Monitor SDK performance with analytics

Troubleshooting

Offerwall not showing

  • Verify your API credentials are correct
  • Check network connectivity and firewall rules
  • Ensure a valid user ID is set before calling show()

Rewards not credited

  • Confirm your S2S webhook endpoint is configured and reachable
  • Validate the HMAC signature verification logic
  • Check your server logs for incoming webhook calls

Support

Need help? Our developer support team is available via:

  • Documentation: docs.Gaintwall.com
  • Email: developers@Gaintwall.com
  • Discord: discord.gg/Gaintwall

Start monetizing in minutes with Gaintwall!

Enjoyed this article? Get more like it

Subscribe for the latest insights and tips delivered to your inbox

No spam. Unsubscribe anytime.