Repository navigation
Home
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.
-
4.4.9:
AdManager.forceShowInterstitialAlways()is now public (it was documented butinternal, 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.
- 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
- 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:adTemplateorsetTemplate() - Custom Templates (v4.3.0+): supply your own layout via
setCustomTemplate()orapp:customAdLayout - Material 3 Theming: Automatic dark/light mode support
- 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
- AdManageKitConfig: Single configuration point
- Environment-specific settings (debug vs production)
- Runtime configuration changes
- Smart retry with exponential backoff
- Circuit breaker for failing ad units
- Memory leak prevention with WeakReference
- UMP consent management (GDPR/CCPA)
- Automatic ad hiding for purchased users
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.
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.
- Interstitial Ads - Complete guide to interstitial ad integration
- Rewarded Ads - Rewarded video ads with callbacks and analytics
- App Open Ads - App open ad implementation
- Native Ads - Native ad caching and NativeTemplateView
- Banner Ads - Banner ad integration
- Ad Loading Strategies - ON_DEMAND, ONLY_CACHE, HYBRID strategies
- Configuration - Complete AdManageKitConfig reference
- Jetpack Compose - Compose integration and helpers
- Multi-Provider Waterfall - Load ads from multiple networks with automatic fallback
- Yandex Integration - Yandex Ads SDK provider setup and configuration
- Billing Integration - Play Billing setup, products, and purchase flows
- Purchase Categories - Product type classification
- Consumable Products - Consumable in-app purchases
- Subscriptions - Subscription state, renewal, and account hold
- Subscription Offers - Multi-offer paywalls, price comparison, trial eligibility
- Subscription Upgrades - Plan changes and proration modes
The app module demonstrates all features. To run:
- Clone:
git clone https://github.com/i2hammad/AdManageKit.git - Open in Android Studio
- Replace placeholder AdMob IDs
- Run on device or emulator
For issues: GitHub Issues or [email protected]
Licensed under the MIT License. See LICENSE.
AdManageKit | GitHub | API Docs | Report Issue | Buy me a coffee