-
Notifications
You must be signed in to change notification settings - Fork 4
Ad Loading Strategies
Muhammad Hammad edited this page Nov 28, 2025
·
1 revision
AdManageKit v2.6.0+ introduces three loading strategies that control how ads are fetched and displayed. Choose the right strategy based on your app's needs for user experience vs. ad coverage.
Always fetch fresh ads with loading UI
AdManageKitConfig.interstitialLoadingStrategy = AdLoadingStrategy.ON_DEMAND| Pros | Cons |
|---|---|
| Maximum ad coverage | May interrupt user flow |
| Always fresh ads | Loading dialog shown |
| Best for important moments | Slower on poor network |
Best for:
- Important monetization points
- After significant user actions
- When you need maximum coverage
Only show ads already preloaded
AdManageKitConfig.interstitialLoadingStrategy = AdLoadingStrategy.ONLY_CACHE| Pros | Cons |
|---|---|
| Instant display | Lower ad coverage |
| Smooth UX | Skips if not cached |
| No loading dialogs | Requires good preloading |
Best for:
- Frequent ad opportunities
- During gameplay
- When UX is priority
Check cache first, fetch if needed
AdManageKitConfig.interstitialLoadingStrategy = AdLoadingStrategy.HYBRID| Pros | Cons |
|---|---|
| Instant when cached | May show dialog if not cached |
| Falls back to fetch | Slightly complex flow |
| Best of both worlds | - |
Best for:
- Most general use cases
- Default recommendation
- Balanced UX and coverage
| Ad Type | ON_DEMAND | ONLY_CACHE | HYBRID |
|---|---|---|---|
| Interstitial | ✅ | ✅ | ✅ |
| App Open | ✅ | ✅ | ✅ |
| Native | ✅ | ❌ | ✅ |
Note: Native ads use shimmer instead of dialog, so ONLY_CACHE hides container if not cached.
// In Application.onCreate()
AdManageKitConfig.apply {
interstitialLoadingStrategy = AdLoadingStrategy.HYBRID
appOpenLoadingStrategy = AdLoadingStrategy.HYBRID
nativeLoadingStrategy = AdLoadingStrategy.HYBRID
}// InterstitialAdBuilder
InterstitialAdBuilder.with(activity)
.adUnit(adUnitId)
.loadingStrategy(AdLoadingStrategy.ONLY_CACHE)
.show { next() }
// NativeTemplateView
nativeTemplateView.loadNativeAd(activity, adUnitId, callback, AdLoadingStrategy.ON_DEMAND)User triggers → Show dialog → Fetch ad →
Loaded: Show ad → Continue
Timeout: Skip → Continue
User triggers → Check cache →
Cached: Show ad → Continue
Not cached: Skip → Continue
User triggers → Check cache →
Cached: Show ad → Continue
Not cached: Show dialog → Fetch →
Loaded: Show ad → Continue
Timeout: Skip → Continue
Load → Check cache →
Cached: Show immediately
Not cached: Show shimmer → Fetch →
Success: Show ad
Failure: Hide container
| Use Case | Recommended |
|---|---|
| Level completion | HYBRID |
| During gameplay | ONLY_CACHE |
| Navigation | ONLY_CACHE |
| Long tasks | ON_DEMAND |
| App open/resume | HYBRID |
| Cold start | ON_DEMAND |
| Feed/list items | ONLY_CACHE |
| Article content | HYBRID |
AdManageKitConfig.apply {
interstitialLoadingStrategy = AdLoadingStrategy.ONLY_CACHE
appOpenLoadingStrategy = AdLoadingStrategy.HYBRID
nativeLoadingStrategy = AdLoadingStrategy.ONLY_CACHE
}AdManageKitConfig.apply {
interstitialLoadingStrategy = AdLoadingStrategy.ON_DEMAND
appOpenLoadingStrategy = AdLoadingStrategy.ON_DEMAND
nativeLoadingStrategy = AdLoadingStrategy.ON_DEMAND
}AdManageKitConfig.apply {
interstitialLoadingStrategy = AdLoadingStrategy.HYBRID
appOpenLoadingStrategy = AdLoadingStrategy.HYBRID
nativeLoadingStrategy = AdLoadingStrategy.HYBRID
}forceShowInterstitial() now respects loading strategy!
// Before v2.8.0: Always fetched fresh
// After v2.8.0: Respects interstitialLoadingStrategy
AdManager.getInstance().forceShowInterstitial(activity, callback)
// To always force fetch (old behavior):
AdManager.getInstance().forceShowInterstitialAlways(activity, callback)-
Set once in
Application.onCreate() - Use HYBRID as default
- Use ONLY_CACHE for frequent interruptions
- Use ON_DEMAND for critical moments
- Enable background preloading for ONLY_CACHE/HYBRID
- Monitor coverage and adjust based on metrics
AdManageKit v3.3.4 | GitHub | API Docs | Report Issue | Buy me a coffee