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,463 @@
1
+ # Loading Strategy Examples
2
+
3
+ This guide provides comprehensive examples for using AdManageKit's loading strategies in different scenarios.
4
+
5
+ ## Table of Contents
6
+ 1. [Quick Start](#quick-start)
7
+ 2. [Configuration Examples](#configuration-examples)
8
+ 3. [Usage Examples](#usage-examples)
9
+ 4. [Real-World Scenarios](#real-world-scenarios)
10
+ 5. [Testing Strategies](#testing-strategies)
11
+
12
+ ---
13
+
14
+ ## Quick Start
15
+
16
+ ### Step 1: Configure Global Strategy in Application
17
+
18
+ ```kotlin
19
+ class MyApplication : Application() {
20
+ override fun onCreate() {
21
+ super.onCreate()
22
+
23
+ AdManageKitConfig.apply {
24
+ // Set default strategies for all ad types
25
+ interstitialLoadingStrategy = AdLoadingStrategy.HYBRID
26
+ appOpenLoadingStrategy = AdLoadingStrategy.HYBRID
27
+ nativeLoadingStrategy = AdLoadingStrategy.HYBRID
28
+ }
29
+ }
30
+ }
31
+ ```
32
+
33
+ ### Step 2: Load Ads
34
+
35
+ ```kotlin
36
+ // Option 1: Use global strategy (no parameter needed)
37
+ nativeLargeView.loadNativeAds(this, "ca-app-pub-xxx")
38
+
39
+ // Option 2: Override with custom strategy
40
+ nativeLargeView.loadNativeAds(
41
+ this,
42
+ "ca-app-pub-xxx",
43
+ loadingStrategy = AdLoadingStrategy.ONLY_CACHE
44
+ )
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Configuration Examples
50
+
51
+ ### Example 1: Gaming App (Smooth UX)
52
+
53
+ ```kotlin
54
+ class GameApplication : Application() {
55
+ override fun onCreate() {
56
+ super.onCreate()
57
+
58
+ AdManageKitConfig.apply {
59
+ // Prioritize smooth gameplay - only show cached ads
60
+ interstitialLoadingStrategy = AdLoadingStrategy.ONLY_CACHE
61
+ nativeLoadingStrategy = AdLoadingStrategy.ONLY_CACHE
62
+
63
+ // App opens can have slight delay
64
+ appOpenLoadingStrategy = AdLoadingStrategy.HYBRID
65
+
66
+ // Enable background preloading for better cache hit rate
67
+ enableSmartPreloading = true
68
+ maxCachedAdsPerUnit = 3
69
+ }
70
+ }
71
+ }
72
+ ```
73
+
74
+ ### Example 2: Utility App (Maximum Revenue)
75
+
76
+ ```kotlin
77
+ class UtilityApplication : Application() {
78
+ override fun onCreate() {
79
+ super.onCreate()
80
+
81
+ AdManageKitConfig.apply {
82
+ // Always try to show ads - maximize revenue
83
+ interstitialLoadingStrategy = AdLoadingStrategy.ON_DEMAND
84
+ appOpenLoadingStrategy = AdLoadingStrategy.ON_DEMAND
85
+ nativeLoadingStrategy = AdLoadingStrategy.ON_DEMAND
86
+
87
+ // Use shorter timeouts for faster flow
88
+ defaultAdTimeout = 5.seconds
89
+ appOpenAdTimeout = 4.seconds
90
+ }
91
+ }
92
+ }
93
+ ```
94
+
95
+ ### Example 3: Content/News App (Balanced)
96
+
97
+ ```kotlin
98
+ class ContentApplication : Application() {
99
+ override fun onCreate() {
100
+ super.onCreate()
101
+
102
+ AdManageKitConfig.apply {
103
+ // Balanced approach - instant when possible, load when needed
104
+ interstitialLoadingStrategy = AdLoadingStrategy.HYBRID
105
+ appOpenLoadingStrategy = AdLoadingStrategy.HYBRID
106
+ nativeLoadingStrategy = AdLoadingStrategy.HYBRID
107
+
108
+ // Enable smart features
109
+ enableSmartPreloading = true
110
+ enableAdaptiveIntervals = true
111
+ }
112
+ }
113
+ }
114
+ ```
115
+
116
+ ### Example 4: Mixed Strategy (Advanced)
117
+
118
+ ```kotlin
119
+ class AdvancedApplication : Application() {
120
+ override fun onCreate() {
121
+ super.onCreate()
122
+
123
+ AdManageKitConfig.apply {
124
+ // Different strategies for different ad types
125
+ appOpenLoadingStrategy = AdLoadingStrategy.ONLY_CACHE // Instant app opens
126
+ interstitialLoadingStrategy = AdLoadingStrategy.ON_DEMAND // Aggressive interstitials
127
+ nativeLoadingStrategy = AdLoadingStrategy.HYBRID // Balanced natives
128
+ }
129
+ }
130
+ }
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Usage Examples
136
+
137
+ ### Native Ads
138
+
139
+ #### Example 1: Using Global Strategy
140
+ ```kotlin
141
+ // Load native ad using the global strategy from AdManageKitConfig
142
+ nativeLargeView.loadNativeAds(this, "ca-app-pub-xxx")
143
+ ```
144
+
145
+ #### Example 2: Force Cached Only (Feed/List)
146
+ ```kotlin
147
+ // Perfect for RecyclerView - only show if already cached
148
+ nativeBannerView.loadNativeBannerAd(
149
+ this,
150
+ "ca-app-pub-xxx",
151
+ loadingStrategy = AdLoadingStrategy.ONLY_CACHE
152
+ )
153
+ ```
154
+
155
+ #### Example 3: Always Fresh (Important Placement)
156
+ ```kotlin
157
+ // Always fetch fresh ad for important monetization points
158
+ nativeLargeView.loadNativeAds(
159
+ this,
160
+ "ca-app-pub-xxx",
161
+ object : AdLoadCallback() {
162
+ override fun onAdLoaded() {
163
+ // Ad loaded and displayed
164
+ }
165
+ override fun onFailedToLoad(error: AdError?) {
166
+ // Handle failure
167
+ }
168
+ },
169
+ loadingStrategy = AdLoadingStrategy.ON_DEMAND
170
+ )
171
+ ```
172
+
173
+ ### Interstitial Ads
174
+
175
+ #### Example 1: Using Global Strategy
176
+ ```kotlin
177
+ InterstitialAdBuilder.with(this)
178
+ .adUnit("ca-app-pub-xxx")
179
+ .show {
180
+ // Next action after ad
181
+ navigateToNextScreen()
182
+ }
183
+ ```
184
+
185
+ #### Example 2: Level Complete (Balanced)
186
+ ```kotlin
187
+ fun onLevelComplete() {
188
+ InterstitialAdBuilder.with(this)
189
+ .adUnit("ca-app-pub-xxx")
190
+ .timeout(5000)
191
+ .show {
192
+ showLevelCompletedScreen()
193
+ }
194
+ }
195
+ ```
196
+
197
+ #### Example 3: During Gameplay (Cached Only)
198
+ ```kotlin
199
+ // Configure globally for smooth gameplay
200
+ AdManageKitConfig.interstitialLoadingStrategy = AdLoadingStrategy.ONLY_CACHE
201
+
202
+ // Show interstitial during natural breaks
203
+ fun onGamePaused() {
204
+ InterstitialAdBuilder.with(this)
205
+ .adUnit("ca-app-pub-xxx")
206
+ .show {
207
+ // Continue game
208
+ }
209
+ }
210
+ ```
211
+
212
+ ### App Open Ads
213
+
214
+ #### Example 1: Splash Screen (Fresh)
215
+ ```kotlin
216
+ class SplashActivity : AppCompatActivity() {
217
+ override fun onCreate(savedInstanceState: Bundle?) {
218
+ super.onCreate(savedInstanceState)
219
+
220
+ // Configure for fresh ad on app start
221
+ AdManageKitConfig.appOpenLoadingStrategy = AdLoadingStrategy.ON_DEMAND
222
+
223
+ appOpenManager?.showAdIfAvailable(
224
+ this,
225
+ onAdDismissed = { navigateToMain() }
226
+ )
227
+ }
228
+ }
229
+ ```
230
+
231
+ #### Example 2: Background Resume (Instant)
232
+ ```kotlin
233
+ class MyApplication : Application() {
234
+ override fun onCreate() {
235
+ super.onCreate()
236
+
237
+ // Show cached ad instantly when returning from background
238
+ AdManageKitConfig.appOpenLoadingStrategy = AdLoadingStrategy.ONLY_CACHE
239
+
240
+ appOpenManager = AppOpenManager(this, "ca-app-pub-xxx")
241
+ }
242
+ }
243
+ ```
244
+
245
+ ---
246
+
247
+ ## Real-World Scenarios
248
+
249
+ ### Scenario 1: RecyclerView with Native Ads
250
+
251
+ ```kotlin
252
+ class FeedAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
253
+ override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
254
+ if (holder is NativeAdViewHolder) {
255
+ // Use ONLY_CACHE for smooth scrolling
256
+ holder.nativeAdView.loadNativeBannerAd(
257
+ context,
258
+ "ca-app-pub-xxx",
259
+ loadingStrategy = AdLoadingStrategy.ONLY_CACHE
260
+ )
261
+ }
262
+ }
263
+ }
264
+ ```
265
+
266
+ ### Scenario 2: Article Detail Page
267
+
268
+ ```kotlin
269
+ class ArticleDetailActivity : AppCompatActivity() {
270
+ override fun onCreate(savedInstanceState: Bundle?) {
271
+ super.onCreate(savedInstanceState)
272
+
273
+ // Use HYBRID - show cached if available, load if not
274
+ nativeLarge.loadNativeAds(
275
+ this,
276
+ "ca-app-pub-xxx",
277
+ object : AdLoadCallback() {
278
+ override fun onAdLoaded() {
279
+ // Ad displayed in article
280
+ }
281
+ },
282
+ loadingStrategy = AdLoadingStrategy.HYBRID
283
+ )
284
+ }
285
+ }
286
+ ```
287
+
288
+ ### Scenario 3: Game Level Complete
289
+
290
+ ```kotlin
291
+ class GameActivity : AppCompatActivity() {
292
+ fun onLevelComplete() {
293
+ // Check global strategy
294
+ when (AdManageKitConfig.interstitialLoadingStrategy) {
295
+ AdLoadingStrategy.ONLY_CACHE -> {
296
+ // Show cached interstitial instantly if available
297
+ InterstitialAdBuilder.with(this)
298
+ .adUnit("ca-app-pub-xxx")
299
+ .show { showRewardScreen() }
300
+ }
301
+ else -> {
302
+ // Show with loading dialog
303
+ InterstitialAdBuilder.with(this)
304
+ .adUnit("ca-app-pub-xxx")
305
+ .timeout(5000)
306
+ .show { showRewardScreen() }
307
+ }
308
+ }
309
+ }
310
+ }
311
+ ```
312
+
313
+ ### Scenario 4: Background Preloading
314
+
315
+ ```kotlin
316
+ class MyApplication : Application() {
317
+ override fun onCreate() {
318
+ super.onCreate()
319
+
320
+ // Enable background preloading for ONLY_CACHE strategy
321
+ AdManageKitConfig.apply {
322
+ nativeLoadingStrategy = AdLoadingStrategy.ONLY_CACHE
323
+ enableSmartPreloading = true
324
+ maxCachedAdsPerUnit = 3
325
+ }
326
+
327
+ // Manually preload ads in background
328
+ lifecycleScope.launch {
329
+ delay(2000) // Wait for app to settle
330
+ preloadNativeAds()
331
+ }
332
+ }
333
+
334
+ private fun preloadNativeAds() {
335
+ val adUnits = listOf(
336
+ "ca-app-pub-xxx/feed",
337
+ "ca-app-pub-xxx/detail",
338
+ "ca-app-pub-xxx/settings"
339
+ )
340
+
341
+ adUnits.forEach { adUnitId ->
342
+ NativeAdManager.preloadAd(this, adUnitId)
343
+ }
344
+ }
345
+ }
346
+ ```
347
+
348
+ ---
349
+
350
+ ## Testing Strategies
351
+
352
+ ### Test Different Strategies in Debug Mode
353
+
354
+ ```kotlin
355
+ class MyApplication : Application() {
356
+ override fun onCreate() {
357
+ super.onCreate()
358
+
359
+ AdManageKitConfig.apply {
360
+ if (BuildConfig.DEBUG) {
361
+ // Test different strategies easily
362
+ when (TEST_STRATEGY) {
363
+ "on_demand" -> {
364
+ interstitialLoadingStrategy = AdLoadingStrategy.ON_DEMAND
365
+ nativeLoadingStrategy = AdLoadingStrategy.ON_DEMAND
366
+ }
367
+ "only_cache" -> {
368
+ interstitialLoadingStrategy = AdLoadingStrategy.ONLY_CACHE
369
+ nativeLoadingStrategy = AdLoadingStrategy.ONLY_CACHE
370
+ }
371
+ else -> {
372
+ interstitialLoadingStrategy = AdLoadingStrategy.HYBRID
373
+ nativeLoadingStrategy = AdLoadingStrategy.HYBRID
374
+ }
375
+ }
376
+ } else {
377
+ // Production: Use HYBRID
378
+ interstitialLoadingStrategy = AdLoadingStrategy.HYBRID
379
+ nativeLoadingStrategy = AdLoadingStrategy.HYBRID
380
+ }
381
+ }
382
+ }
383
+
384
+ companion object {
385
+ const val TEST_STRATEGY = "hybrid" // Change this to test different strategies
386
+ }
387
+ }
388
+ ```
389
+
390
+ ### Monitor Strategy Performance
391
+
392
+ ```kotlin
393
+ class StrategyMonitorActivity : AppCompatActivity() {
394
+ override fun onResume() {
395
+ super.onResume()
396
+
397
+ // Log cache statistics to evaluate strategy effectiveness
398
+ val stats = NativeAdManager.getCacheStatistics()
399
+ stats.forEach { (adUnit, metrics) ->
400
+ Log.d("StrategyMonitor", """
401
+ Ad Unit: $adUnit
402
+ Cache Hits: ${metrics["hits"]}
403
+ Cache Misses: ${metrics["misses"]}
404
+ Hit Rate: ${calculateHitRate(metrics)}%
405
+ """.trimIndent())
406
+ }
407
+ }
408
+
409
+ private fun calculateHitRate(metrics: Map<String, Int>): Int {
410
+ val hits = metrics["hits"] ?: 0
411
+ val total = hits + (metrics["misses"] ?: 0)
412
+ return if (total > 0) (hits * 100 / total) else 0
413
+ }
414
+ }
415
+ ```
416
+
417
+ ---
418
+
419
+ ## Strategy Comparison Table
420
+
421
+ | Scenario | Recommended Strategy | Reason |
422
+ |----------|---------------------|--------|
423
+ | **Gaming - During Gameplay** | `ONLY_CACHE` | No interruptions, smooth UX |
424
+ | **Gaming - Level Complete** | `HYBRID` | Balance between UX and revenue |
425
+ | **Utility - Task Complete** | `ON_DEMAND` | User expects wait, maximize revenue |
426
+ | **News Feed - Inline Ads** | `ONLY_CACHE` | Smooth scrolling |
427
+ | **Article Detail** | `HYBRID` | Balance UX and coverage |
428
+ | **App Launch** | `HYBRID` or `ON_DEMAND` | Acceptable wait time |
429
+ | **Background Resume** | `ONLY_CACHE` | Instant return |
430
+ | **Settings Screen** | `ONLY_CACHE` | Static content |
431
+ | **Video Completion** | `ON_DEMAND` | User just watched video |
432
+
433
+ ---
434
+
435
+ ## Best Practices
436
+
437
+ 1. **Start with HYBRID** - It's the recommended default for most apps
438
+ 2. **Use ONLY_CACHE** for smooth UX - Great for gaming and scrolling
439
+ 3. **Use ON_DEMAND** for important moments - Maximize revenue at key points
440
+ 4. **Enable Smart Preloading** - Essential for ONLY_CACHE strategy
441
+ 5. **Monitor Cache Hit Rate** - Adjust strategy based on metrics
442
+ 6. **Test Different Strategies** - A/B test to find optimal strategy
443
+ 7. **Mix Strategies** - Different strategies for different ad types is okay
444
+
445
+ ---
446
+
447
+ ## Migration from Old API
448
+
449
+ ### Before (Deprecated)
450
+ ```kotlin
451
+ nativeLarge.loadNativeAds(this, "ca-app-pub-xxx", useCachedAd = true)
452
+ ```
453
+
454
+ ### After (Recommended)
455
+ ```kotlin
456
+ nativeLarge.loadNativeAds(
457
+ this,
458
+ "ca-app-pub-xxx",
459
+ loadingStrategy = AdLoadingStrategy.HYBRID
460
+ )
461
+ ```
462
+
463
+ The old `useCachedAd` parameter still works but is deprecated. Migrate to `loadingStrategy` for more control and clarity.