-
Notifications
You must be signed in to change notification settings - Fork 4
Configuration
Muhammad Hammad edited this page Nov 28, 2025
·
1 revision
AdManageKitConfig is the central configuration object for all AdManageKit features. Configure it once in your Application.onCreate() and all ad components will respect these settings.
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
// Configure billing first
BillingConfig.setPurchaseProvider(BillingPurchaseProvider())
// Configure AdManageKit
AdManageKitConfig.apply {
// Debug settings
debugMode = BuildConfig.DEBUG
testMode = false
// Loading strategies
interstitialLoadingStrategy = AdLoadingStrategy.HYBRID
appOpenLoadingStrategy = AdLoadingStrategy.HYBRID
nativeLoadingStrategy = AdLoadingStrategy.HYBRID
// Auto-reload (v2.8.0+)
interstitialAutoReload = true
}
}
}| Setting | Description | Default |
|---|---|---|
defaultAdTimeout |
Timeout for ad loading | 15 seconds |
nativeCacheExpiry |
Cache expiry for native ads | 1 hour |
maxCachedAdsPerUnit |
Max cached ads per unit | 3 |
AdManageKitConfig.apply {
defaultAdTimeout = 15.seconds
nativeCacheExpiry = 1.hours
maxCachedAdsPerUnit = 3
}| Setting | Description | Default |
|---|---|---|
autoRetryFailedAds |
Enable auto retry | true |
maxRetryAttempts |
Max retry attempts | 3 |
circuitBreakerThreshold |
Failures before circuit trips | 5 |
circuitBreakerResetTimeout |
Circuit reset timeout | 5 minutes |
AdManageKitConfig.apply {
autoRetryFailedAds = true
maxRetryAttempts = 3
circuitBreakerThreshold = 5
circuitBreakerResetTimeout = 300.seconds
}| Setting | Description | Default |
|---|---|---|
enableSmartPreloading |
Smart preload based on usage | false |
enableAdaptiveIntervals |
Adjust intervals by success rate | false |
enablePerformanceMetrics |
Enable metrics collection | false |
enableAutoCacheCleanup |
Auto cleanup on low memory | true |
AdManageKitConfig.apply {
enableSmartPreloading = true
enableAdaptiveIntervals = true
enablePerformanceMetrics = BuildConfig.DEBUG
enableAutoCacheCleanup = true
}| Setting | Description | Default |
|---|---|---|
debugMode |
Enable debug logging | false |
testMode |
Use test ads | false |
privacyCompliantMode |
GDPR/CCPA compliance | true |
enableDebugOverlay |
Show debug overlay | false |
AdManageKitConfig.apply {
debugMode = BuildConfig.DEBUG
testMode = false
privacyCompliantMode = true
enableDebugOverlay = BuildConfig.DEBUG
}| Setting | Description | Default |
|---|---|---|
defaultInterstitialInterval |
Time between ads | 15 seconds |
interstitialAutoReload |
Auto-reload after show | true |
interstitialLoadingStrategy |
Loading strategy | HYBRID |
AdManageKitConfig.apply {
defaultInterstitialInterval = 20.seconds
interstitialAutoReload = true
interstitialLoadingStrategy = AdLoadingStrategy.HYBRID
}| Setting | Description | Default |
|---|---|---|
defaultBannerRefreshInterval |
Banner refresh interval | 60 seconds |
enableCollapsibleBannersByDefault |
Enable collapsible | false |
defaultCollapsiblePlacement |
Collapsible position | BOTTOM |
AdManageKitConfig.apply {
defaultBannerRefreshInterval = 60.seconds
enableCollapsibleBannersByDefault = false
defaultCollapsiblePlacement = CollapsibleBannerPlacement.BOTTOM
}| Setting | Description | Default |
|---|---|---|
appOpenAdTimeout |
Load timeout | 4 seconds |
appOpenFetchFreshAd |
Disable prefetching | false |
appOpenLoadingStrategy |
Loading strategy | HYBRID |
AdManageKitConfig.apply {
appOpenAdTimeout = 4.seconds
appOpenFetchFreshAd = false
appOpenLoadingStrategy = AdLoadingStrategy.HYBRID
}| Setting | Description | Default |
|---|---|---|
dialogBackgroundColor |
Dialog background | transparent |
dialogOverlayColor |
Overlay color | 50% black |
dialogCardBackgroundColor |
Card background | theme default |
welcomeDialogAppIcon |
App icon resource | 0 |
welcomeDialogTitle |
Title text | "Welcome Back!" |
welcomeDialogSubtitle |
Subtitle text | "Loading..." |
welcomeDialogFooter |
Footer text | "Just a moment..." |
welcomeDialogDismissDelay |
Dismiss delay | 0.8 seconds |
loadingDialogTitle |
Interstitial title | "Loading Ad" |
loadingDialogSubtitle |
Interstitial subtitle | "Please wait..." |
AdManageKitConfig.apply {
welcomeDialogAppIcon = R.mipmap.ic_launcher
welcomeDialogTitle = "Welcome Back!"
dialogOverlayColor = 0x80000000.toInt()
}| Setting | Description | Default |
|---|---|---|
maxCacheMemoryMB |
Max cache memory | 200 MB |
enableLRUEviction |
LRU cache eviction | true |
cacheCleanupInterval |
Cleanup interval | 30 minutes |
AdManageKitConfig.apply {
maxCacheMemoryMB = 200
enableLRUEviction = true
cacheCleanupInterval = 30.seconds * 60
}| Setting | Description | Default |
|---|---|---|
enableExponentialBackoff |
Exponential retry | true |
baseRetryDelay |
First retry delay | 1 second |
maxRetryDelay |
Max retry delay | 30 seconds |
AdManageKitConfig.apply {
enableExponentialBackoff = true
baseRetryDelay = 1.seconds
maxRetryDelay = 30.seconds
}AdManageKitConfig.resetToDefaults()val isValid = AdManageKitConfig.validate()
// Logs warnings in debug mode for invalid settingsval summary = AdManageKitConfig.getConfigSummary()
Log.d("Config", summary)if (AdManageKitConfig.isProductionReady()) {
// Configuration is suitable for production
}-
Configure early - Set in
Application.onCreate() -
Use BuildConfig - Set
debugMode = BuildConfig.DEBUG -
Validate before release - Use
isProductionReady() - Different strategies - Use appropriate strategies per ad type
-
Privacy first - Keep
privacyCompliantMode = true
AdManageKit v3.3.4 | GitHub | API Docs | Report Issue | Buy me a coffee