admanagekit-mcp-server 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/content/README.md +851 -0
  2. package/content/docs/AD_FREQUENCY_CONTROL.md +450 -0
  3. package/content/docs/AD_LOADING_STRATEGIES.md +369 -0
  4. package/content/docs/API_REFERENCE.md +734 -0
  5. package/content/docs/APP_PURCHASE_GUIDE.md +704 -0
  6. package/content/docs/BANNER_AD_IMPROVEMENTS.md +325 -0
  7. package/content/docs/COMPOSE_INTEGRATION.md +477 -0
  8. package/content/docs/CONFIGURATION_USAGE.md +168 -0
  9. package/content/docs/INTERSTITIAL_BUILDER_GUIDE.md +518 -0
  10. package/content/docs/JAVA_USAGE_GUIDE.md +785 -0
  11. package/content/docs/LOADING_STRATEGY_EXAMPLES.md +463 -0
  12. package/content/docs/NATIVE_AD_MANAGER_ENHANCEMENTS.md +347 -0
  13. package/content/docs/NATIVE_AD_PRELOADING.md +467 -0
  14. package/content/docs/NATIVE_TEMPLATE_VIEW.md +413 -0
  15. package/content/docs/app-open-ads.md +412 -0
  16. package/content/docs/interstitial-ads.md +269 -0
  17. package/content/docs/native-ads-caching.md +182 -0
  18. package/content/docs/release-notes/RELEASE_NOTES_v2.1.0.md +156 -0
  19. package/content/docs/release-notes/RELEASE_NOTES_v2.2.0.md +248 -0
  20. package/content/docs/release-notes/RELEASE_NOTES_v2.3.0.md +280 -0
  21. package/content/docs/release-notes/RELEASE_NOTES_v2.5.0.md +73 -0
  22. package/content/docs/release-notes/RELEASE_NOTES_v2.6.0.md +265 -0
  23. package/content/docs/release-notes/RELEASE_NOTES_v2.7.0.md +168 -0
  24. package/content/docs/release-notes/RELEASE_NOTES_v2.8.0.md +153 -0
  25. package/content/docs/release-notes/RELEASE_NOTES_v2.9.0.md +479 -0
  26. package/content/docs/release-notes/RELEASE_NOTES_v3.0.0.md +343 -0
  27. package/content/docs/release-notes/RELEASE_NOTES_v3.1.0.md +131 -0
  28. package/content/docs/release-notes/RELEASE_NOTES_v3.3.0.md +252 -0
  29. package/content/docs/release-notes/RELEASE_NOTES_v3.3.2.md +215 -0
  30. package/content/docs/release-notes/RELEASE_NOTES_v3.3.3.md +116 -0
  31. package/content/docs/release-notes/RELEASE_NOTES_v3.3.4.md +142 -0
  32. package/content/docs/release-notes/RELEASE_NOTES_v3.3.5.md +94 -0
  33. package/content/docs/rewarded-ads.md +623 -0
  34. package/content/wiki/Ad-Loading-Strategies.md +209 -0
  35. package/content/wiki/App-Open-Ads.md +189 -0
  36. package/content/wiki/Banner-Ads.md +133 -0
  37. package/content/wiki/Billing-Integration.md +69 -0
  38. package/content/wiki/Configuration.md +252 -0
  39. package/content/wiki/Consumable-Products.md +166 -0
  40. package/content/wiki/Home.md +144 -0
  41. package/content/wiki/Interstitial-Ads.md +313 -0
  42. package/content/wiki/Jetpack-Compose.md +270 -0
  43. package/content/wiki/NativeAdManager.md +220 -0
  44. package/content/wiki/Purchase-Categories.md +94 -0
  45. package/content/wiki/Rewarded-Ads.md +420 -0
  46. package/content/wiki/Subscription-Upgrades.md +278 -0
  47. package/content/wiki/Subscriptions.md +368 -0
  48. package/content/wiki/_Footer.md +3 -0
  49. package/content/wiki/_Sidebar.md +18 -0
  50. package/dist/index.d.ts +2 -0
  51. package/dist/index.js +6 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/server.d.ts +1 -0
  54. package/dist/server.js +18 -0
  55. package/dist/server.js.map +1 -0
  56. package/dist/tools/code-generation.d.ts +2 -0
  57. package/dist/tools/code-generation.js +264 -0
  58. package/dist/tools/code-generation.js.map +1 -0
  59. package/dist/tools/documentation.d.ts +2 -0
  60. package/dist/tools/documentation.js +202 -0
  61. package/dist/tools/documentation.js.map +1 -0
  62. package/dist/types.d.ts +18 -0
  63. package/dist/types.js +83 -0
  64. package/dist/types.js.map +1 -0
  65. package/dist/utils/doc-loader.d.ts +17 -0
  66. package/dist/utils/doc-loader.js +245 -0
  67. package/dist/utils/doc-loader.js.map +1 -0
  68. package/dist/utils/search.d.ts +2 -0
  69. package/dist/utils/search.js +62 -0
  70. package/dist/utils/search.js.map +1 -0
  71. package/dist/utils/templates.d.ts +60 -0
  72. package/dist/utils/templates.js +793 -0
  73. package/dist/utils/templates.js.map +1 -0
  74. package/package.json +51 -0
@@ -0,0 +1,734 @@
1
+ # AdManageKit API Reference
2
+
3
+ This document provides comprehensive API documentation for AdManageKit library version 2.5.0.
4
+
5
+ ## Table of Contents
6
+ - [Core Configuration](#core-configuration)
7
+ - [Ad Management](#ad-management)
8
+ - [Billing Management](#billing-management)
9
+ - [Retry Logic](#retry-logic)
10
+ - [Caching System](#caching-system)
11
+ - [Debug & Testing](#debug--testing)
12
+ - [Callbacks & Listeners](#callbacks--listeners)
13
+ - [Utility Classes](#utility-classes)
14
+
15
+ ## Core Configuration
16
+
17
+ ### AdManageKitConfig
18
+
19
+ Centralized configuration object for the entire library.
20
+
21
+ ```kotlin
22
+ object AdManageKitConfig {
23
+ // Performance Settings
24
+ var debugMode: Boolean
25
+ var defaultAdTimeout: Duration
26
+ var nativeCacheExpiry: Duration
27
+ var maxCachedAdsPerUnit: Int
28
+
29
+ // Reliability Features (v2.5.0: Circuit breaker removed)
30
+ var autoRetryFailedAds: Boolean
31
+ var maxRetryAttempts: Int
32
+ var baseRetryDelay: Duration
33
+
34
+ // Advanced Features
35
+ var enableSmartPreloading: Boolean
36
+ var enableAdaptiveIntervals: Boolean
37
+ var enablePerformanceMetrics: Boolean
38
+
39
+ // Testing & Debug
40
+ var testMode: Boolean
41
+ var testDeviceId: String?
42
+ var privacyCompliantMode: Boolean
43
+
44
+ // Utility Methods
45
+ fun resetToDefaults()
46
+ fun validate()
47
+ fun getConfigSummary(): String
48
+ }
49
+ ```
50
+
51
+ **Usage Example:**
52
+ ```kotlin
53
+ AdManageKitConfig.apply {
54
+ debugMode = BuildConfig.DEBUG
55
+ defaultAdTimeout = 15.seconds
56
+ autoRetryFailedAds = true
57
+ maxRetryAttempts = 3
58
+ }
59
+ ```
60
+
61
+ ### BillingConfig
62
+
63
+ Configuration for purchase providers.
64
+
65
+ ```kotlin
66
+ object BillingConfig {
67
+ fun setPurchaseProvider(provider: AppPurchaseProvider)
68
+ fun getPurchaseProvider(): AppPurchaseProvider
69
+ }
70
+ ```
71
+
72
+ ## Ad Management
73
+
74
+ ### AdManager
75
+
76
+ Singleton class for managing interstitial ads.
77
+
78
+ #### Methods
79
+
80
+ ```kotlin
81
+ class AdManager {
82
+ companion object {
83
+ fun getInstance(): AdManager
84
+ }
85
+
86
+ // Loading Methods
87
+ fun loadInterstitialAd(context: Context, adUnitId: String)
88
+ fun loadInterstitialAdForSplash(
89
+ context: Context,
90
+ adUnitId: String,
91
+ timeoutMillis: Long,
92
+ callback: AdManagerCallback
93
+ )
94
+
95
+ // Display Methods
96
+ fun forceShowInterstitial(activity: Activity, callback: AdManagerCallback)
97
+ fun forceShowInterstitialWithDialog(
98
+ activity: Activity,
99
+ callback: AdManagerCallback,
100
+ isReload: Boolean = true
101
+ )
102
+ fun showInterstitialAdByTime(activity: Activity, callback: AdManagerCallback)
103
+ fun showInterstitialAdByCount(
104
+ activity: Activity,
105
+ callback: AdManagerCallback,
106
+ maxDisplayCount: Int
107
+ )
108
+
109
+ // State Methods
110
+ fun isReady(): Boolean
111
+ fun isDisplayingAd(): Boolean
112
+ fun setAdInterval(intervalMillis: Long)
113
+ fun getAdDisplayCount(): Int
114
+ fun setAdDisplayCount(count: Int)
115
+ }
116
+ ```
117
+
118
+ ### AppOpenManager
119
+
120
+ Manages app open ads with lifecycle awareness.
121
+
122
+ #### Constructor
123
+ ```kotlin
124
+ class AppOpenManager(
125
+ private val myApplication: Application,
126
+ private var adUnitId: String
127
+ )
128
+ ```
129
+
130
+ #### Methods
131
+ ```kotlin
132
+ // Display Methods
133
+ fun showAdIfAvailable()
134
+ fun forceShowAdIfAvailable(activity: Activity, callback: AdManagerCallback)
135
+ fun skipNextAd()
136
+
137
+ // Loading Methods
138
+ fun fetchAd()
139
+ fun fetchAd(callback: AdLoadCallback, timeoutMillis: Long = 5000)
140
+
141
+ // Configuration Methods
142
+ fun disableAppOpenWithActivity(activityClass: Class<*>)
143
+ fun includeAppOpenActivityForAds(activityClass: Class<*>)
144
+
145
+ // State Methods
146
+ fun isAdAvailable(): Boolean
147
+ ```
148
+
149
+ ### BannerAdView
150
+
151
+ Custom view for banner ads with shimmer loading.
152
+
153
+ #### Methods
154
+ ```kotlin
155
+ // Loading Methods
156
+ fun loadBanner(context: Activity?, adUnitId: String?)
157
+ fun loadBanner(context: Activity?, adUnitId: String?, callback: AdLoadCallback?)
158
+ fun loadCollapsibleBanner(context: Activity?, adUnitId: String?, collapsible: Boolean)
159
+ fun loadCollapsibleBanner(
160
+ context: Activity?,
161
+ adUnitId: String?,
162
+ collapsible: Boolean,
163
+ callback: AdLoadCallback?
164
+ )
165
+
166
+ // Control Methods
167
+ fun hideAd()
168
+ fun showAd()
169
+ fun destroyAd()
170
+ fun resumeAd()
171
+ fun pauseAd()
172
+ fun setAdCallback(callback: AdLoadCallback?)
173
+ ```
174
+
175
+ ### Native Ad Views
176
+
177
+ #### NativeBannerSmall, NativeBannerMedium, NativeLarge
178
+
179
+ ```kotlin
180
+ // Loading Methods
181
+ fun loadNativeBannerAd(activity: Activity, adUnitId: String)
182
+ fun loadNativeBannerAd(
183
+ activity: Activity,
184
+ adUnitId: String,
185
+ useCachedAd: Boolean
186
+ )
187
+ fun loadNativeBannerAd(
188
+ activity: Activity,
189
+ adUnitId: String,
190
+ useCachedAd: Boolean,
191
+ callback: AdLoadCallback
192
+ )
193
+
194
+ // For NativeLarge
195
+ fun loadNativeAds(activity: Activity, adUnitId: String)
196
+ fun loadNativeAds(
197
+ activity: Activity,
198
+ adUnitId: String,
199
+ useCachedAd: Boolean
200
+ )
201
+ fun loadNativeAds(
202
+ activity: Activity,
203
+ adUnitId: String,
204
+ useCachedAd: Boolean,
205
+ callback: AdLoadCallback
206
+ )
207
+ ```
208
+
209
+ ### RewardedAdManager
210
+
211
+ Singleton class for managing rewarded ads with comprehensive lifecycle callbacks, automatic retry, and Firebase Analytics integration.
212
+
213
+ #### Features (v3.4.0+)
214
+ - Automatic retry with exponential backoff on load failures
215
+ - Purchase status integration (ads disabled for premium users)
216
+ - Timeout support for splash screen scenarios
217
+ - Detailed Firebase Analytics tracking (requests, fills, impressions)
218
+ - Configurable auto-reload after ad dismissal
219
+
220
+ #### Callback Interfaces
221
+
222
+ ```kotlin
223
+ object RewardedAdManager {
224
+ /**
225
+ * Full lifecycle callback for rewarded ad events.
226
+ */
227
+ interface RewardedAdCallback {
228
+ fun onRewardEarned(rewardType: String, rewardAmount: Int)
229
+ fun onAdDismissed()
230
+ fun onAdShowed() {} // Optional
231
+ fun onAdFailedToShow(error: AdError) {} // Optional
232
+ fun onAdClicked() {} // Optional
233
+ }
234
+
235
+ /**
236
+ * Callback for ad loading events.
237
+ */
238
+ interface OnRewardedAdLoadCallback {
239
+ fun onAdLoaded()
240
+ fun onAdFailedToLoad(error: LoadAdError)
241
+ }
242
+
243
+ /**
244
+ * Legacy callback (deprecated).
245
+ */
246
+ @Deprecated("Use RewardedAdCallback instead")
247
+ interface OnAdDismissedListener {
248
+ fun onAdDismissed()
249
+ }
250
+ }
251
+ ```
252
+
253
+ #### Methods
254
+
255
+ ```kotlin
256
+ object RewardedAdManager {
257
+ // =================== INITIALIZATION ===================
258
+
259
+ /**
260
+ * Initialize with ad unit ID. Automatically starts loading.
261
+ */
262
+ fun initialize(context: Context, adUnitId: String)
263
+
264
+ // =================== LOADING ===================
265
+
266
+ /**
267
+ * Load a rewarded ad.
268
+ * Skips if: already loading, already loaded, or user is premium.
269
+ */
270
+ fun loadRewardedAd(context: Context)
271
+
272
+ /**
273
+ * Load with callback notification.
274
+ */
275
+ fun loadRewardedAd(context: Context, callback: OnRewardedAdLoadCallback)
276
+
277
+ /**
278
+ * Load with timeout support (for splash screens).
279
+ * Callback fires once: on load, fail, or timeout.
280
+ */
281
+ fun loadRewardedAdWithTimeout(
282
+ context: Context,
283
+ timeoutMillis: Long = AdManageKitConfig.defaultAdTimeout.inWholeMilliseconds,
284
+ callback: OnRewardedAdLoadCallback
285
+ )
286
+
287
+ // =================== DISPLAY ===================
288
+
289
+ /**
290
+ * Show with full callback support.
291
+ * @param autoReload Whether to reload after dismissal (default: AdManageKitConfig.rewardedAutoReload)
292
+ */
293
+ fun showAd(
294
+ activity: Activity,
295
+ callback: RewardedAdCallback,
296
+ autoReload: Boolean = AdManageKitConfig.rewardedAutoReload
297
+ )
298
+
299
+ /**
300
+ * Legacy show method (deprecated).
301
+ */
302
+ @Deprecated("Use showAd with RewardedAdCallback")
303
+ fun showAd(
304
+ activity: Activity,
305
+ onUserEarnedRewardListener: OnUserEarnedRewardListener,
306
+ onAdDismissedListener: OnAdDismissedListener
307
+ )
308
+
309
+ // =================== STATE ===================
310
+
311
+ /**
312
+ * Check if ad is loaded and ready (returns false for premium users).
313
+ */
314
+ fun isAdLoaded(): Boolean
315
+
316
+ /**
317
+ * Check if a load request is in progress.
318
+ */
319
+ fun isLoading(): Boolean
320
+
321
+ /**
322
+ * Check if ad is currently being displayed.
323
+ */
324
+ fun isShowingAd(): Boolean
325
+
326
+ // =================== UTILITIES ===================
327
+
328
+ /**
329
+ * Preload ad during natural pauses to improve show rate.
330
+ */
331
+ fun preload(context: Context)
332
+
333
+ /**
334
+ * Get session statistics for debugging.
335
+ */
336
+ fun getAdStats(): Map<String, Any>
337
+
338
+ /**
339
+ * Reset session statistics.
340
+ */
341
+ fun resetAdStats()
342
+ }
343
+ ```
344
+
345
+ #### Usage Examples
346
+
347
+ **Basic Usage:**
348
+ ```kotlin
349
+ // Initialize once (e.g., in Application.onCreate())
350
+ RewardedAdManager.initialize(context, "ca-app-pub-xxx/yyy")
351
+
352
+ // Show when ready
353
+ if (RewardedAdManager.isAdLoaded()) {
354
+ RewardedAdManager.showAd(activity, object : RewardedAdManager.RewardedAdCallback {
355
+ override fun onRewardEarned(rewardType: String, rewardAmount: Int) {
356
+ grantReward(rewardType, rewardAmount)
357
+ }
358
+ override fun onAdDismissed() {
359
+ continueGameFlow()
360
+ }
361
+ })
362
+ }
363
+ ```
364
+
365
+ **With Timeout (Splash Screen):**
366
+ ```kotlin
367
+ RewardedAdManager.loadRewardedAdWithTimeout(
368
+ context = this,
369
+ timeoutMillis = 5000,
370
+ callback = object : RewardedAdManager.OnRewardedAdLoadCallback {
371
+ override fun onAdLoaded() {
372
+ // Ad ready, show it
373
+ showRewardedAd()
374
+ }
375
+ override fun onAdFailedToLoad(error: LoadAdError) {
376
+ // Proceed without ad
377
+ navigateToMain()
378
+ }
379
+ }
380
+ )
381
+ ```
382
+
383
+ **Preloading:**
384
+ ```kotlin
385
+ // Preload during natural pauses
386
+ override fun onResume() {
387
+ super.onResume()
388
+ RewardedAdManager.preload(this)
389
+ }
390
+ ```
391
+
392
+ **Analytics:**
393
+ ```kotlin
394
+ val stats = RewardedAdManager.getAdStats()
395
+ Log.d("Ads", "Fill rate: ${stats["fill_rate_percent"]}%")
396
+ Log.d("Ads", "Show rate: ${stats["show_rate_percent"]}%")
397
+ ```
398
+
399
+ ## Billing Management
400
+
401
+ ### AppPurchase
402
+
403
+ Main billing client wrapper.
404
+
405
+ #### Key Methods
406
+ ```kotlin
407
+ class AppPurchase {
408
+ companion object {
409
+ fun getInstance(): AppPurchase
410
+ }
411
+
412
+ // Initialization
413
+ fun initBilling(
414
+ application: Application,
415
+ purchaseItems: List<PurchaseItem>
416
+ )
417
+
418
+ // Purchase Flow
419
+ fun purchase(activity: Activity, productId: String)
420
+ fun consumePurchase(productId: String)
421
+
422
+ // Product Information
423
+ fun queryProductDetails(productIds: List<String>, productType: String)
424
+ fun getPrice(productId: String): String
425
+ fun getCurrency(productId: String, type: TYPE_IAP): String
426
+ fun getPriceWithoutCurrency(productId: String, type: TYPE_IAP): Double
427
+
428
+ // State
429
+ val isBillingInitialized: Boolean
430
+
431
+ // Listeners
432
+ fun setPurchaseListener(listener: PurchaseListener)
433
+ fun setBillingListener(listener: BillingListener, timeout: Long)
434
+ }
435
+ ```
436
+
437
+ ### PurchaseItem
438
+
439
+ Data class for purchase items.
440
+
441
+ ```kotlin
442
+ data class PurchaseItem(
443
+ val productId: String,
444
+ val offerToken: String = "",
445
+ val type: AppPurchase.TYPE_IAP
446
+ )
447
+ ```
448
+
449
+ ## Retry Logic
450
+
451
+ **Note**: Circuit breaker pattern was removed in v2.5.0 to maximize ad show rates. Retry logic with exponential backoff is still available.
452
+
453
+ ### AdRetryManager
454
+
455
+ Manages retry operations with exponential backoff.
456
+
457
+ ```kotlin
458
+ class AdRetryManager {
459
+ companion object {
460
+ fun getInstance(): AdRetryManager
461
+ }
462
+
463
+ // Retry Operations
464
+ fun scheduleRetry(
465
+ adUnitId: String,
466
+ attempt: Int,
467
+ maxAttempts: Int = AdManageKitConfig.maxRetryAttempts,
468
+ retryAction: suspend () -> Unit
469
+ )
470
+
471
+ // Control
472
+ fun cancelRetry(adUnitId: String)
473
+ fun cancelAllRetries()
474
+
475
+ // Information
476
+ fun hasActiveRetry(adUnitId: String): Boolean
477
+ fun getCurrentAttempt(adUnitId: String): Int
478
+ fun getActiveRetriesSummary(): Map<String, String>
479
+
480
+ // Cleanup
481
+ fun cleanup()
482
+ }
483
+ ```
484
+
485
+ ## Caching System
486
+
487
+ ### NativeAdManager
488
+
489
+ Enhanced caching system for native ads.
490
+
491
+ ```kotlin
492
+ object NativeAdManager {
493
+ // Configuration
494
+ var enableCachingNativeAds: Boolean
495
+
496
+ // Cache Operations
497
+ fun setCachedNativeAd(adUnitId: String, ad: NativeAd)
498
+ fun getCachedNativeAd(adUnitId: String): NativeAd?
499
+ fun clearCachedAd(adUnitId: String)
500
+ fun clearAllCachedAds()
501
+
502
+ // Maintenance
503
+ fun performCleanup()
504
+
505
+ // Statistics
506
+ fun getCacheStatistics(): Map<String, String>
507
+ fun getCacheSize(adUnitId: String): Int
508
+ fun getTotalCacheSize(): Int
509
+ fun hasCachedAds(adUnitId: String): Boolean
510
+ }
511
+ ```
512
+
513
+ ## Debug & Testing
514
+
515
+ ### AdDebugUtils
516
+
517
+ Comprehensive debugging utilities.
518
+
519
+ ```kotlin
520
+ object AdDebugUtils {
521
+ // Debug Overlay
522
+ fun enableDebugOverlay(activity: Activity, enabled: Boolean)
523
+
524
+ // Test Configuration
525
+ fun setTestAdUnits(testUnits: Map<String, String>)
526
+ fun getTestAdUnit(productionAdUnit: String): String
527
+
528
+ // Mock Responses
529
+ fun injectMockAds(mockResponses: List<MockAdResponse>)
530
+ fun getMockResponse(adUnitId: String): MockAdResponse?
531
+
532
+ // Debug Callbacks
533
+ fun createDebugCallback(
534
+ adUnitId: String,
535
+ originalCallback: AdLoadCallback? = null
536
+ ): AdLoadCallback
537
+
538
+ // Event Logging
539
+ fun logEvent(adUnitId: String, eventType: String, details: String, success: Boolean = true)
540
+ fun showDebugToast(context: Context, message: String)
541
+
542
+ // Data Export
543
+ fun getAdEvents(): List<AdEvent>
544
+ fun clearAdEvents()
545
+ fun exportDebugInfo(): String
546
+
547
+ // Data Classes
548
+ data class AdEvent(
549
+ val timestamp: Long,
550
+ val adUnitId: String,
551
+ val eventType: String,
552
+ val details: String,
553
+ val success: Boolean
554
+ )
555
+
556
+ data class MockAdResponse(
557
+ val adUnitId: String,
558
+ val shouldSucceed: Boolean = true,
559
+ val delayMs: Long = 1000,
560
+ val errorCode: Int = 0,
561
+ val errorMessage: String = "",
562
+ val adValue: AdValue? = null
563
+ )
564
+ }
565
+ ```
566
+
567
+ ## Callbacks & Listeners
568
+
569
+ ### AdLoadCallback
570
+
571
+ Enhanced callback for ad lifecycle events.
572
+
573
+ ```kotlin
574
+ abstract class AdLoadCallback {
575
+ // Core Events
576
+ open fun onAdLoaded()
577
+ open fun onFailedToLoad(error: AdError?)
578
+ open fun onAdClicked()
579
+ open fun onAdClosed()
580
+ open fun onAdImpression()
581
+ open fun onAdOpened()
582
+
583
+ // Enhanced Events (New in 2.1.0)
584
+ open fun onPaidEvent(adValue: AdValue)
585
+ open fun onAdLoadStarted()
586
+ open fun onAdLoadCancelled()
587
+ }
588
+ ```
589
+
590
+ ### AdManagerCallback
591
+
592
+ Callback for ad manager operations.
593
+
594
+ ```kotlin
595
+ abstract class AdManagerCallback : AdLoadCallback() {
596
+ open fun onNextAction()
597
+ }
598
+ ```
599
+
600
+ ### BillingListener
601
+
602
+ Callback for billing initialization.
603
+
604
+ ```kotlin
605
+ interface BillingListener {
606
+ fun onInitBillingFinished(resultCode: Int)
607
+ }
608
+ ```
609
+
610
+ ### PurchaseListener
611
+
612
+ Callback for purchase operations.
613
+
614
+ ```kotlin
615
+ interface PurchaseListener {
616
+ fun onProductPurchased(orderId: String, originalJson: String)
617
+ fun displayErrorMessage(errorMessage: String)
618
+ fun onUserCancelBilling()
619
+ }
620
+ ```
621
+
622
+ ### UMPResultListener
623
+
624
+ Callback for UMP consent operations.
625
+
626
+ ```kotlin
627
+ interface UMPResultListener {
628
+ fun onCheckUMPSuccess(isConsentGiven: Boolean)
629
+ }
630
+ ```
631
+
632
+ ## Utility Classes
633
+
634
+ ### WeakReferenceHolder
635
+
636
+ Generic weak reference holder to prevent memory leaks.
637
+
638
+ ```kotlin
639
+ class WeakReferenceHolder<T : Any>(referent: T?) {
640
+ fun get(): T?
641
+ fun withReference(action: (T) -> Unit): Boolean
642
+ fun withReferenceOrElse(action: (T) -> Unit, fallback: () -> Unit)
643
+ fun isValid(): Boolean
644
+ fun clear()
645
+ }
646
+ ```
647
+
648
+ ### WeakActivityHolder
649
+
650
+ Specialized holder for Activity references.
651
+
652
+ ```kotlin
653
+ class WeakActivityHolder(activity: Activity?) : WeakReferenceHolder<Activity>(activity) {
654
+ fun withValidActivity(action: (Activity) -> Unit): Boolean
655
+ fun isActivityValid(): Boolean
656
+ }
657
+ ```
658
+
659
+ ### WeakContextHolder
660
+
661
+ Specialized holder for Context references.
662
+
663
+ ```kotlin
664
+ class WeakContextHolder(context: Context?) : WeakReferenceHolder<Context>(context) {
665
+ fun getApplicationContext(): Context?
666
+ fun withApplicationContext(action: (Context) -> Unit): Boolean
667
+ }
668
+ ```
669
+
670
+ ### Extension Functions
671
+
672
+ ```kotlin
673
+ // Extension functions for easy weak reference creation
674
+ fun <T : Any> T?.weak(): WeakReferenceHolder<T>
675
+ fun Activity?.weakActivity(): WeakActivityHolder
676
+ fun Context?.weakContext(): WeakContextHolder
677
+ ```
678
+
679
+ ## Constants & Enums
680
+
681
+ ### Error Codes
682
+
683
+ ```kotlin
684
+ // AdManager Error Codes
685
+ const val PURCHASED_APP_ERROR_CODE = 1001
686
+ const val PURCHASED_APP_ERROR_DOMAIN = "com.i2hammad.admanagekit"
687
+ const val PURCHASED_APP_ERROR_MESSAGE = "Ads are not shown because the app has been purchased."
688
+ ```
689
+
690
+ ### Ad Types
691
+
692
+ ```kotlin
693
+ // AppPurchase Types
694
+ enum class TYPE_IAP {
695
+ PURCHASE, SUBSCRIPTION
696
+ }
697
+ ```
698
+
699
+ ## Best Practices
700
+
701
+ ### Initialization Order
702
+ 1. Configure `AdManageKitConfig` first
703
+ 2. Set up billing provider with `BillingConfig.setPurchaseProvider()`
704
+ 3. Initialize `AppOpenManager` if using app open ads
705
+ 4. Initialize MobileAds SDK
706
+ 5. Request UMP consent
707
+
708
+ ### Memory Management
709
+ - Always use WeakReference holders for Activity/Context references
710
+ - Call cleanup methods in appropriate lifecycle events
711
+ - Use `onDestroy()` to clean up ad resources
712
+
713
+ ### Error Handling
714
+ - Always implement `onFailedToLoad()` in callbacks
715
+ - Configure retry logic with exponential backoff (circuit breaker removed in v2.5.0)
716
+ - Monitor retry statistics in debug builds
717
+ - Rely on automatic retry system for failed loads
718
+
719
+ ### Testing
720
+ - Use `AdManageKitConfig.testMode = true` for development
721
+ - Set test ad units with `AdDebugUtils.setTestAdUnits()`
722
+ - Enable debug overlay for real-time monitoring
723
+ - Use mock responses for unit testing
724
+
725
+ ## Changelog
726
+
727
+ ### v2.5.0
728
+ - Removed circuit breaker to maximize ad show rates
729
+ - Added custom ad unit support to AppOpenManager
730
+ - Enhanced retry logic with configurable exponential backoff
731
+ - Added performance metrics tracking
732
+ - Improved thread safety across all components
733
+
734
+ This API reference covers all major components of AdManageKit 2.5.0. For more detailed examples and usage patterns, refer to the main README and sample project.