Skip to content
github-actions[bot] edited this page Oct 20, 2026 · 13 revisions

AdManageKit

JitPack API License

AdManageKit is a comprehensive Android library designed to simplify the integration and management of Google AdMob ads, Google Play Billing, and User Messaging Platform (UMP) consent.

Latest Version: 4.4.9 · Changelog · Release Notes

Requires Kotlin 2.3+ in your app as of 4.4.8 (AdManageKit and Firebase BOM 35 ship Kotlin 2.4 metadata). ⚠️ Avoid 4.4.3: its billing regression makes purchases unusable.

Recent Releases

  • 4.4.9: AdManager.forceShowInterstitialAlways() is now public (it was documented but internal, so app calls failed to compile). Build moved to AGP built-in Kotlin; artifacts unchanged
  • 4.4.8: Google Mobile Ads Next-Gen SDK 1.5.0, Firebase BOM 35.0.2, Kotlin 2.4, AGP 9.4.1, Yandex Mobile Ads 8.6.0. Apps now need Kotlin 2.3+
  • 4.4.7: Consumer ProGuard rules no longer pin the Compose runtime; apps that run R8 build smaller with nothing to configure
  • 4.4.6: WorkManager pinned to 2.9.1 to avoid a startup crash on ROMs that spoof API 34. Pin it in your app too
  • 4.4.5: Fixed a banner that loaded but rendered blank inside Jetpack Compose
  • 4.4.4: Critical billing fix: the Play Billing connection never started on 4.4.3
  • 4.4.0: Subscription offers can be bought individually, plus price comparison, trial eligibility and client-side account hold. See Subscription Offers
  • 4.2.0: Migrated to the Google Mobile Ads Next-Gen SDK and Play Billing 9. MobileAds.initialize() must now be called explicitly before any ad request

Upgrading from 3.x or earlier? Read the Migrating to 4.2.0 notes first. It's the one release in the 4.x line that isn't source-compatible.

Features

AdMob Ads Management

  • Banner Ads: Auto-refresh, collapsible banners, smart retry
  • Native Ads: Small, Medium, Large formats with caching
  • Interstitial Ads: Time/count-based triggers, dialog support, loading strategies
  • App Open Ads: Lifecycle-aware with activity exclusion

NativeTemplateView (v2.6.0+)

  • 38 Template Styles: card_modern, material3, minimal, list_item, magazine, app_store, social_feed, spotlight, plus the video_* and flat_* families
  • XML & Programmatic: Set templates via app:adTemplate or setTemplate()
  • Custom Templates (v4.3.0+): supply your own layout via setCustomTemplate() or app:customAdLayout
  • Material 3 Theming: Automatic dark/light mode support

Ad Loading Strategies (v2.6.0+)

  • ON_DEMAND: Fetch fresh ads with loading dialog
  • ONLY_CACHE: Instant display from cache
  • HYBRID: Cache-first with fallback fetch (recommended)
  • FRESH_WITH_CACHE_FALLBACK: Fetch fresh, fall back to cache on failure

Centralized Configuration

  • AdManageKitConfig: Single configuration point
  • Environment-specific settings (debug vs production)
  • Runtime configuration changes

Reliability & Performance

  • Smart retry with exponential backoff
  • Circuit breaker for failing ad units
  • Memory leak prevention with WeakReference

Privacy & Compliance

  • UMP consent management (GDPR/CCPA)
  • Automatic ad hiding for purchased users

Getting Started

Installation

Step 1: Add JitPack to your root build.gradle:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}

Step 2: Add dependencies to your app's build.gradle:

implementation 'com.github.i2hammad.AdManageKit:ad-manage-kit:v4.4.9'
implementation 'com.github.i2hammad.AdManageKit:ad-manage-kit-billing:v4.4.9'
implementation 'com.github.i2hammad.AdManageKit:ad-manage-kit-core:v4.4.9'

// For Jetpack Compose support
implementation 'com.github.i2hammad.AdManageKit:ad-manage-kit-compose:v4.4.9'

// For Yandex Ads multi-provider support
implementation 'com.github.i2hammad.AdManageKit:ad-manage-kit-yandex:v4.4.9'

Step 3: Ensure your app uses compileSdk 37+ (since 4.2.0) and Kotlin 2.3+ (since 4.4.8).

Step 4: Sync your project with Gradle.

Quick Configuration

Configure AdManageKit in your Application class:

Since 4.2.0 you must call MobileAds.initialize() yourself. The Next-Gen SDK removed the legacy SDK's silent lazy-init, so an app that skips it never loads ads. AdManageKit does not call it for you, because it does not own your consent flow.

class MyApp : Application() {
    var appOpenManager: AppOpenManager? = null

    override fun onCreate() {
        super.onCreate()

        initAds()

        // Set up billing
        BillingConfig.setPurchaseProvider(BillingPurchaseProvider())

        // Configure AdManageKit
        AdManageKitConfig.apply {
            debugMode = BuildConfig.DEBUG
            enableSmartPreloading = true
            autoRetryFailedAds = true

            // Ad Loading Strategies
            interstitialLoadingStrategy = AdLoadingStrategy.HYBRID
            appOpenLoadingStrategy = AdLoadingStrategy.HYBRID
            nativeLoadingStrategy = AdLoadingStrategy.HYBRID

            // Auto-reload interstitial after showing
            interstitialAutoReload = true  // default: true
        }
    }

    private fun initAds() {
        val config = InitializationConfig.Builder(readApplicationIdFromManifest()).build()

        // initialize() blocks, so keep it off the main thread or it can ANR.
        Thread {
            MobileAds.initialize(this, config)

            // Construct AppOpenManager only after initialize() returns. Constructing it
            // arms its ProcessLifecycleOwner observer, and onStart() fires as soon as any
            // activity starts — created earlier, that observer can race ahead of
            // initialization and issue a load the Next-Gen SDK rejects as "not initialized".
            Handler(Looper.getMainLooper()).post {
                appOpenManager = AppOpenManager(this, "your-app-open-ad-unit-id")
            }
        }.start()
    }
}

The Next-Gen SDK no longer reads the application id from the manifest automatically, so readApplicationIdFromManifest() pulls com.google.android.gms.ads.APPLICATION_ID from your ApplicationInfo metadata. See the sample app's MyApplication.kt for the full version.

Wiki Pages

Ad Types

Features

Multi-Provider Ads

Billing

Sample Project

The app module demonstrates all features. To run:

  1. Clone: git clone https://github.com/i2hammad/AdManageKit.git
  2. Open in Android Studio
  3. Replace placeholder AdMob IDs
  4. Run on device or emulator

Support

Buy me a coffee

For issues: GitHub Issues or [email protected]

License

Licensed under the MIT License. See LICENSE.

Clone this wiki locally