SDK Documentation

Complete integration guide and API reference for Honchads SDK

Quick Start Guide

Get up and running with Honchads SDK in just 30 minutes. Follow these simple steps to start monetizing your mobile app.

1 Create Account: Sign up for a free developer account at our dashboard.
2 Get App ID: Create your app profile and obtain your unique App ID.
3 Install SDK: Add Honchads SDK to your project using your preferred method.
4 Initialize: Initialize the SDK with your App ID in your application.
5 Show Ads: Implement ad formats and start earning revenue.

Installation

Android Integration

Add the Honchads SDK to your Android project using Gradle.

// In your app-level build.gradle file
dependencies {
    implementation 'com.honchads.sdk:honchads-android:3.2.1'
}

// Add to your AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application>
    <meta-data 
        android:name="com.honchads.APPLICATION_ID"
        android:value="YOUR_APP_ID_HERE" />
</application>

iOS Integration

Add the Honchads SDK to your iOS project using CocoaPods or Swift Package Manager.

# CocoaPods - Add to your Podfile
pod 'HonchadsSDK', '~> 3.2.1'

# Swift Package Manager
https://github.com/honchads/honchads-ios-sdk.git

# Add to Info.plist
<key>HonchadsAppID</key>
<string>YOUR_APP_ID_HERE</string>

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>
Note: Make sure to replace "YOUR_APP_ID_HERE" with your actual App ID from the developer dashboard.

SDK Initialization

Android Initialization

// In your Application class or MainActivity
import com.honchads.sdk.HonchadsSDK;
import com.honchads.sdk.HonchadsInitCallback;

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        
        HonchadsSDK.initialize(this, new HonchadsInitCallback() {
            @Override
            public void onInitializationComplete() {
                Log.d("Honchads", "SDK initialized successfully");
                // SDK is ready to use
            }
            
            @Override
            public void onInitializationFailed(String error) {
                Log.e("Honchads", "SDK initialization failed: " + error);
            }
        });
    }
}

iOS Initialization

// In your AppDelegate.swift
import HonchadsSDK

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
    
    func application(_ application: UIApplication, 
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        
        HonchadsSDK.initialize { result in
            switch result {
            case .success:
                print("Honchads SDK initialized successfully")
                // SDK is ready to use
            case .failure(let error):
                print("Honchads SDK initialization failed: \(error)")
            }
        }
        
        return true
    }
}

Splash Ads Implementation

Splash ads are full-screen ads that appear when users launch your app. They provide an excellent monetization opportunity without disrupting the user experience.

Android Implementation

import com.honchads.sdk.splash.SplashAd;
import com.honchads.sdk.splash.SplashAdListener;

public class SplashActivity extends AppCompatActivity {
    private SplashAd mSplashAd;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        // Create splash ad
        mSplashAd = new SplashAd(this, "splash-placement-001");
        mSplashAd.setListener(new SplashAdListener() {
            @Override
            public void onAdLoaded() {
                Log.d("SplashAd", "Ad loaded successfully");
            }
            
            @Override
            public void onAdShown() {
                Log.d("SplashAd", "Ad displayed");
            }
            
            @Override
            public void onAdClicked() {
                Log.d("SplashAd", "Ad clicked");
            }
            
            @Override
            public void onAdClosed() {
                Log.d("SplashAd", "Ad closed");
                // Navigate to main activity
                startMainActivity();
            }
            
            @Override
            public void onAdFailed(String error) {
                Log.e("SplashAd", "Ad failed to load: " + error);
                // Show app content immediately
                startMainActivity();
            }
        });
        
        // Load and show splash ad
        mSplashAd.loadAndShow();
    }
    
    private void startMainActivity() {
        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();
    }
}

Configuration Options

Parameter Type Default Description
timeout Integer 5000ms Maximum time to wait for ad loading
skipAfter Integer 3000ms Time before skip button appears
orientation String "auto" Ad display orientation (portrait/landscape/auto)

Interstitial Ads Implementation

Interstitial ads are full-screen ads shown at natural transition points in your app flow.

import com.honchads.sdk.interstitial.InterstitialAd;
import com.honchads.sdk.interstitial.InterstitialAdListener;

public class GameActivity extends AppCompatActivity {
    private InterstitialAd mInterstitialAd;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        // Initialize interstitial ad
        mInterstitialAd = new InterstitialAd(this, "interstitial-001");
        mInterstitialAd.setListener(new InterstitialAdListener() {
            @Override
            public void onAdLoaded() {
                Log.d("InterstitialAd", "Ad ready to show");
            }
            
            @Override
            public void onAdShown() {
                // Pause game or app functionality
                pauseGame();
            }
            
            @Override
            public void onAdClosed() {
                // Resume game or app functionality
                resumeGame();
                // Pre-load next ad
                mInterstitialAd.load();
            }
            
            @Override
            public void onAdFailed(String error) {
                Log.e("InterstitialAd", "Ad failed: " + error);
            }
        });
        
        // Pre-load the ad
        mInterstitialAd.load();
    }
    
    // Show ad at appropriate moment (e.g., level completion)
    private void onLevelCompleted() {
        if (mInterstitialAd.isReady()) {
            mInterstitialAd.show();
        } else {
            // Continue without ad
            showLevelCompletedDialog();
        }
    }
}
Best Practice: Always pre-load interstitial ads to ensure they're ready when needed. Show them at natural breaking points in your app flow.

Testing & Debug Mode

Enable test mode during development to receive test ads and debug information.

// Enable test mode (Android)
HonchadsSDK.setTestMode(true);
HonchadsSDK.setLogLevel(LogLevel.DEBUG);

// Add test device ID
HonchadsSDK.addTestDevice("YOUR_TEST_DEVICE_ID");

// iOS
HonchadsSDK.setTestMode(true)
HonchadsSDK.setLogLevel(.debug)
HonchadsSDK.addTestDevice("YOUR_TEST_DEVICE_ID")
Remember: Always disable test mode before releasing your app to production!

Error Codes Reference

Common error codes and their meanings:

Error Code Description Solution
1001 Invalid App ID Check your App ID in the dashboard
1002 Invalid Placement ID Verify placement ID configuration
2001 Network Error Check internet connection
3001 No Ad Available No ads to serve at this time
4001 Ad Load Timeout Increase timeout or check network