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.
- package/content/README.md +851 -0
- package/content/docs/AD_FREQUENCY_CONTROL.md +450 -0
- package/content/docs/AD_LOADING_STRATEGIES.md +369 -0
- package/content/docs/API_REFERENCE.md +734 -0
- package/content/docs/APP_PURCHASE_GUIDE.md +704 -0
- package/content/docs/BANNER_AD_IMPROVEMENTS.md +325 -0
- package/content/docs/COMPOSE_INTEGRATION.md +477 -0
- package/content/docs/CONFIGURATION_USAGE.md +168 -0
- package/content/docs/INTERSTITIAL_BUILDER_GUIDE.md +518 -0
- package/content/docs/JAVA_USAGE_GUIDE.md +785 -0
- package/content/docs/LOADING_STRATEGY_EXAMPLES.md +463 -0
- package/content/docs/NATIVE_AD_MANAGER_ENHANCEMENTS.md +347 -0
- package/content/docs/NATIVE_AD_PRELOADING.md +467 -0
- package/content/docs/NATIVE_TEMPLATE_VIEW.md +413 -0
- package/content/docs/app-open-ads.md +412 -0
- package/content/docs/interstitial-ads.md +269 -0
- package/content/docs/native-ads-caching.md +182 -0
- package/content/docs/release-notes/RELEASE_NOTES_v2.1.0.md +156 -0
- package/content/docs/release-notes/RELEASE_NOTES_v2.2.0.md +248 -0
- package/content/docs/release-notes/RELEASE_NOTES_v2.3.0.md +280 -0
- package/content/docs/release-notes/RELEASE_NOTES_v2.5.0.md +73 -0
- package/content/docs/release-notes/RELEASE_NOTES_v2.6.0.md +265 -0
- package/content/docs/release-notes/RELEASE_NOTES_v2.7.0.md +168 -0
- package/content/docs/release-notes/RELEASE_NOTES_v2.8.0.md +153 -0
- package/content/docs/release-notes/RELEASE_NOTES_v2.9.0.md +479 -0
- package/content/docs/release-notes/RELEASE_NOTES_v3.0.0.md +343 -0
- package/content/docs/release-notes/RELEASE_NOTES_v3.1.0.md +131 -0
- package/content/docs/release-notes/RELEASE_NOTES_v3.3.0.md +252 -0
- package/content/docs/release-notes/RELEASE_NOTES_v3.3.2.md +215 -0
- package/content/docs/release-notes/RELEASE_NOTES_v3.3.3.md +116 -0
- package/content/docs/release-notes/RELEASE_NOTES_v3.3.4.md +142 -0
- package/content/docs/release-notes/RELEASE_NOTES_v3.3.5.md +94 -0
- package/content/docs/rewarded-ads.md +623 -0
- package/content/wiki/Ad-Loading-Strategies.md +209 -0
- package/content/wiki/App-Open-Ads.md +189 -0
- package/content/wiki/Banner-Ads.md +133 -0
- package/content/wiki/Billing-Integration.md +69 -0
- package/content/wiki/Configuration.md +252 -0
- package/content/wiki/Consumable-Products.md +166 -0
- package/content/wiki/Home.md +144 -0
- package/content/wiki/Interstitial-Ads.md +313 -0
- package/content/wiki/Jetpack-Compose.md +270 -0
- package/content/wiki/NativeAdManager.md +220 -0
- package/content/wiki/Purchase-Categories.md +94 -0
- package/content/wiki/Rewarded-Ads.md +420 -0
- package/content/wiki/Subscription-Upgrades.md +278 -0
- package/content/wiki/Subscriptions.md +368 -0
- package/content/wiki/_Footer.md +3 -0
- package/content/wiki/_Sidebar.md +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.js +18 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/code-generation.d.ts +2 -0
- package/dist/tools/code-generation.js +264 -0
- package/dist/tools/code-generation.js.map +1 -0
- package/dist/tools/documentation.d.ts +2 -0
- package/dist/tools/documentation.js +202 -0
- package/dist/tools/documentation.js.map +1 -0
- package/dist/types.d.ts +18 -0
- package/dist/types.js +83 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/doc-loader.d.ts +17 -0
- package/dist/utils/doc-loader.js +245 -0
- package/dist/utils/doc-loader.js.map +1 -0
- package/dist/utils/search.d.ts +2 -0
- package/dist/utils/search.js +62 -0
- package/dist/utils/search.js.map +1 -0
- package/dist/utils/templates.d.ts +60 -0
- package/dist/utils/templates.js +793 -0
- package/dist/utils/templates.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
# Ad Loading Strategies Guide
|
|
2
|
+
|
|
3
|
+
**New in v2.6.0** - AdManageKit supports three different ad loading strategies to fit different use cases in your app.
|
|
4
|
+
|
|
5
|
+
## Strategy Availability
|
|
6
|
+
|
|
7
|
+
| Strategy | Interstitial | App Open | Native |
|
|
8
|
+
|----------|-------------|----------|--------|
|
|
9
|
+
| ON_DEMAND | ✅ | ✅ | ✅ |
|
|
10
|
+
| ONLY_CACHE | ✅ | ✅ | ❌ |
|
|
11
|
+
| HYBRID | ✅ | ✅ | ✅ |
|
|
12
|
+
|
|
13
|
+
> **Note:** `ONLY_CACHE` is only available for **Interstitial** and **App Open** ads. Native ads display inline with shimmer loading, so they always need to load content.
|
|
14
|
+
|
|
15
|
+
## Strategy Types
|
|
16
|
+
|
|
17
|
+
### 1. ON_DEMAND
|
|
18
|
+
**Always fetch and display fresh ads when needed**
|
|
19
|
+
|
|
20
|
+
- ✅ Shows loading dialog while fetching
|
|
21
|
+
- ✅ Waits for ad within timeout period (default: 4-15 seconds)
|
|
22
|
+
- ✅ Best ad coverage - always tries to show
|
|
23
|
+
- ❌ May interrupt user flow with loading
|
|
24
|
+
- ❌ Slower if network is poor
|
|
25
|
+
|
|
26
|
+
**Best for:**
|
|
27
|
+
- Important monetization points
|
|
28
|
+
- After significant user actions (level completion, purchase flow)
|
|
29
|
+
- When you want maximum ad coverage
|
|
30
|
+
|
|
31
|
+
**How it works:**
|
|
32
|
+
```
|
|
33
|
+
User triggers ad → Show loading dialog → Fetch fresh ad →
|
|
34
|
+
If loaded within timeout: Show ad → Continue
|
|
35
|
+
If timeout: Skip ad → Continue
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### 2. ONLY_CACHE
|
|
41
|
+
**Only show ads that are already preloaded**
|
|
42
|
+
|
|
43
|
+
- ✅ Instant display - no waiting
|
|
44
|
+
- ✅ Smooth user experience
|
|
45
|
+
- ✅ No loading dialogs
|
|
46
|
+
- ❌ Lower ad coverage - skips if not cached
|
|
47
|
+
- ❌ Requires good background preloading
|
|
48
|
+
|
|
49
|
+
**Best for:**
|
|
50
|
+
- Frequent ad opportunities
|
|
51
|
+
- During gameplay or critical flows
|
|
52
|
+
- When user experience is priority over coverage
|
|
53
|
+
|
|
54
|
+
**How it works:**
|
|
55
|
+
```
|
|
56
|
+
User triggers ad → Check cache →
|
|
57
|
+
If cached: Show ad immediately → Continue
|
|
58
|
+
If not cached: Skip → Continue
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
### 3. HYBRID (Recommended)
|
|
64
|
+
**Check cache first, fetch if needed**
|
|
65
|
+
|
|
66
|
+
- ✅ Instant when cached (best UX)
|
|
67
|
+
- ✅ Still tries fetching if not cached (good coverage)
|
|
68
|
+
- ✅ Balanced approach
|
|
69
|
+
- ⚠️ May show loading dialog if cache is empty
|
|
70
|
+
|
|
71
|
+
**Best for:**
|
|
72
|
+
- Most general use cases
|
|
73
|
+
- Default recommendation
|
|
74
|
+
- Good balance between UX and coverage
|
|
75
|
+
|
|
76
|
+
**How it works:**
|
|
77
|
+
```
|
|
78
|
+
User triggers ad → Check cache →
|
|
79
|
+
If cached: Show ad immediately → Continue
|
|
80
|
+
If not cached: Show loading dialog → Fetch fresh ad →
|
|
81
|
+
If loaded within timeout: Show ad → Continue
|
|
82
|
+
If timeout: Skip ad → Continue
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Native Ads Behavior
|
|
88
|
+
|
|
89
|
+
Native ads work differently from interstitial/app open ads:
|
|
90
|
+
|
|
91
|
+
### Loading UI
|
|
92
|
+
- **No loading dialog** - Native ads use shimmer effect instead
|
|
93
|
+
- **Container visibility** - The ad container shows/hides based on strategy
|
|
94
|
+
|
|
95
|
+
### Strategy Behavior
|
|
96
|
+
|
|
97
|
+
**ON_DEMAND:**
|
|
98
|
+
```
|
|
99
|
+
Load native ad → Show shimmer → Fetch ad →
|
|
100
|
+
✅ Show ad when loaded → Hide shimmer
|
|
101
|
+
❌ On failure → Hide container
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**ONLY_CACHE:**
|
|
105
|
+
```
|
|
106
|
+
Load native ad → Check cache →
|
|
107
|
+
✅ Show cached ad immediately → No shimmer
|
|
108
|
+
❌ No cache → Hide container immediately
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**HYBRID:**
|
|
112
|
+
```
|
|
113
|
+
Load native ad → Check cache →
|
|
114
|
+
✅ Show cached ad immediately → No shimmer
|
|
115
|
+
OR
|
|
116
|
+
→ Show shimmer → Fetch fresh ad →
|
|
117
|
+
✅ Show ad when loaded → Hide shimmer
|
|
118
|
+
❌ On failure → Hide container
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Usage Example
|
|
122
|
+
|
|
123
|
+
```kotlin
|
|
124
|
+
// Native ad view respects the configured strategy
|
|
125
|
+
nativeLargeView.loadNativeAds(
|
|
126
|
+
activity = this,
|
|
127
|
+
adUnitId = "ca-app-pub-xxx"
|
|
128
|
+
// No need to pass useCachedAd - uses config strategy automatically
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
// Or override for specific case
|
|
132
|
+
nativeLargeView.loadNativeAds(
|
|
133
|
+
activity = this,
|
|
134
|
+
adUnitId = "ca-app-pub-xxx",
|
|
135
|
+
useCachedAd = true // Force ONLY_CACHE for this ad
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
// NativeTemplateView with strategy override (NEW in 2.6.0)
|
|
139
|
+
nativeTemplateView.loadNativeAd(
|
|
140
|
+
activity = this,
|
|
141
|
+
adUnitId = "ca-app-pub-xxx",
|
|
142
|
+
loadingStrategy = AdLoadingStrategy.HYBRID
|
|
143
|
+
)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Configuration
|
|
149
|
+
|
|
150
|
+
### Basic Setup
|
|
151
|
+
|
|
152
|
+
```kotlin
|
|
153
|
+
class MyApplication : Application() {
|
|
154
|
+
override fun onCreate() {
|
|
155
|
+
super.onCreate()
|
|
156
|
+
|
|
157
|
+
// Set strategy for interstitial ads
|
|
158
|
+
AdManageKitConfig.interstitialLoadingStrategy = AdLoadingStrategy.HYBRID
|
|
159
|
+
|
|
160
|
+
// Set strategy for app open ads
|
|
161
|
+
AdManageKitConfig.appOpenLoadingStrategy = AdLoadingStrategy.HYBRID
|
|
162
|
+
|
|
163
|
+
// Set strategy for native ads
|
|
164
|
+
AdManageKitConfig.nativeLoadingStrategy = AdLoadingStrategy.HYBRID
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Strategy Selection Guide
|
|
170
|
+
|
|
171
|
+
| Use Case | Recommended Strategy | Why |
|
|
172
|
+
|----------|---------------------|-----|
|
|
173
|
+
| **Interstitial Ads** | | |
|
|
174
|
+
| After level completion | `HYBRID` or `ON_DEMAND` | Important monetization point |
|
|
175
|
+
| During gameplay | `ONLY_CACHE` | Don't interrupt gameplay |
|
|
176
|
+
| Navigation between screens | `ONLY_CACHE` | Smooth navigation |
|
|
177
|
+
| After long tasks (video render, etc.) | `ON_DEMAND` | User expects wait anyway |
|
|
178
|
+
| Frequent button clicks | `ONLY_CACHE` | Don't annoy user |
|
|
179
|
+
| **App Open Ads** | | |
|
|
180
|
+
| App open/resume | `HYBRID` | Balance UX and coverage |
|
|
181
|
+
| Cold start | `ON_DEMAND` | User expects startup time |
|
|
182
|
+
| Background return | `ONLY_CACHE` | Quick return to app |
|
|
183
|
+
| **Native Ads** | | |
|
|
184
|
+
| Feed/List items | `ONLY_CACHE` | Instant display, smooth scrolling |
|
|
185
|
+
| Article content | `HYBRID` | Balance coverage and UX |
|
|
186
|
+
| Static placements | `ON_DEMAND` | Always fill the space |
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Example Configurations
|
|
191
|
+
|
|
192
|
+
### Gaming App - Maximize UX
|
|
193
|
+
|
|
194
|
+
```kotlin
|
|
195
|
+
class GameApplication : Application() {
|
|
196
|
+
override fun onCreate() {
|
|
197
|
+
super.onCreate()
|
|
198
|
+
|
|
199
|
+
// During gameplay - only cached ads
|
|
200
|
+
AdManageKitConfig.interstitialLoadingStrategy = AdLoadingStrategy.ONLY_CACHE
|
|
201
|
+
|
|
202
|
+
// App open - balanced approach
|
|
203
|
+
AdManageKitConfig.appOpenLoadingStrategy = AdLoadingStrategy.HYBRID
|
|
204
|
+
|
|
205
|
+
// Native ads in feed - instant display
|
|
206
|
+
AdManageKitConfig.nativeLoadingStrategy = AdLoadingStrategy.ONLY_CACHE
|
|
207
|
+
|
|
208
|
+
// Enable background prefetching for ONLY_CACHE to work well
|
|
209
|
+
AdManageKitConfig.appOpenFetchFreshAd = false // Enable auto-fetch
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// In your game code
|
|
214
|
+
fun onLevelComplete() {
|
|
215
|
+
// Shows cached ad instantly if available, skips if not
|
|
216
|
+
InterstitialAdBuilder.with(this)
|
|
217
|
+
.adUnit("ca-app-pub-xxx")
|
|
218
|
+
.show {
|
|
219
|
+
navigateToNextLevel()
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Utility App - Maximize Revenue
|
|
225
|
+
|
|
226
|
+
```kotlin
|
|
227
|
+
class UtilityApplication : Application() {
|
|
228
|
+
override fun onCreate() {
|
|
229
|
+
super.onCreate()
|
|
230
|
+
|
|
231
|
+
// Always try to fetch fresh ads
|
|
232
|
+
AdManageKitConfig.interstitialLoadingStrategy = AdLoadingStrategy.ON_DEMAND
|
|
233
|
+
AdManageKitConfig.appOpenLoadingStrategy = AdLoadingStrategy.ON_DEMAND
|
|
234
|
+
AdManageKitConfig.nativeLoadingStrategy = AdLoadingStrategy.ON_DEMAND
|
|
235
|
+
|
|
236
|
+
// Shorter timeout for faster flow
|
|
237
|
+
AdManageKitConfig.defaultAdTimeout = 5.seconds
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// After task completion
|
|
242
|
+
fun onTaskComplete() {
|
|
243
|
+
// Always tries to fetch and show fresh ad
|
|
244
|
+
InterstitialAdBuilder.with(this)
|
|
245
|
+
.adUnit("ca-app-pub-xxx")
|
|
246
|
+
.timeout(5000) // 5 second timeout
|
|
247
|
+
.show {
|
|
248
|
+
showResults()
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Content App - Balanced
|
|
254
|
+
|
|
255
|
+
```kotlin
|
|
256
|
+
class ContentApplication : Application() {
|
|
257
|
+
override fun onCreate() {
|
|
258
|
+
super.onCreate()
|
|
259
|
+
|
|
260
|
+
// Default HYBRID strategy for all ad types
|
|
261
|
+
AdManageKitConfig.interstitialLoadingStrategy = AdLoadingStrategy.HYBRID
|
|
262
|
+
AdManageKitConfig.appOpenLoadingStrategy = AdLoadingStrategy.HYBRID
|
|
263
|
+
AdManageKitConfig.nativeLoadingStrategy = AdLoadingStrategy.HYBRID
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Navigation
|
|
268
|
+
fun onArticleFinished() {
|
|
269
|
+
// Shows cached if available, fetches if not
|
|
270
|
+
InterstitialAdBuilder.with(this)
|
|
271
|
+
.adUnit("ca-app-pub-xxx")
|
|
272
|
+
.show {
|
|
273
|
+
loadNextArticle()
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## How It Works Internally
|
|
281
|
+
|
|
282
|
+
### Current Implementation Mapping
|
|
283
|
+
|
|
284
|
+
**New in v2.8.0:** `forceShowInterstitial()` now respects the global loading strategy!
|
|
285
|
+
|
|
286
|
+
**For Interstitial Ads:**
|
|
287
|
+
- `ON_DEMAND`: Uses `forceShowInterstitialAlways()` with dialog
|
|
288
|
+
- `ONLY_CACHE`: Uses `showInterstitialIfReady()`
|
|
289
|
+
- `HYBRID`: Checks cache first, falls back to `forceShowInterstitialAlways()` if empty
|
|
290
|
+
|
|
291
|
+
**Direct AdManager Methods (v2.8.0+):**
|
|
292
|
+
```kotlin
|
|
293
|
+
// Now respects AdManageKitConfig.interstitialLoadingStrategy
|
|
294
|
+
AdManager.getInstance().forceShowInterstitial(activity, callback)
|
|
295
|
+
|
|
296
|
+
// Always forces fresh fetch (bypasses strategy)
|
|
297
|
+
AdManager.getInstance().forceShowInterstitialAlways(activity, callback)
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**For App Open Ads:**
|
|
301
|
+
- `ON_DEMAND`: Discards cache, fetches with welcome dialog
|
|
302
|
+
- `ONLY_CACHE`: Only shows `if (isAdAvailable())`
|
|
303
|
+
- `HYBRID`: Shows cached, fetches with dialog if not available (current default)
|
|
304
|
+
|
|
305
|
+
### Background Preloading
|
|
306
|
+
|
|
307
|
+
For `ONLY_CACHE` and `HYBRID` strategies to work effectively:
|
|
308
|
+
|
|
309
|
+
```kotlin
|
|
310
|
+
// Enable background ad preloading
|
|
311
|
+
AdManageKitConfig.appOpenFetchFreshAd = false // Enables auto-fetch
|
|
312
|
+
|
|
313
|
+
// Or manually preload ads
|
|
314
|
+
InterstitialAdBuilder.with(this)
|
|
315
|
+
.adUnit("ca-app-pub-xxx")
|
|
316
|
+
.preload()
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Migration from Old API
|
|
322
|
+
|
|
323
|
+
**v2.8.0+:** Old methods now automatically respect loading strategy!
|
|
324
|
+
|
|
325
|
+
```kotlin
|
|
326
|
+
// Set strategy once
|
|
327
|
+
AdManageKitConfig.interstitialLoadingStrategy = AdLoadingStrategy.HYBRID
|
|
328
|
+
|
|
329
|
+
// Old methods now respect strategy (v2.8.0+)
|
|
330
|
+
AdManager.getInstance().forceShowInterstitial(activity, callback)
|
|
331
|
+
// → HYBRID: shows cached or fetches fresh
|
|
332
|
+
|
|
333
|
+
// If you need old behavior (always force fetch), use:
|
|
334
|
+
AdManager.getInstance().forceShowInterstitialAlways(activity, callback)
|
|
335
|
+
|
|
336
|
+
// Or use the builder for more control
|
|
337
|
+
InterstitialAdBuilder.with(activity)
|
|
338
|
+
.adUnit("ca-app-pub-xxx")
|
|
339
|
+
.loadingStrategy(AdLoadingStrategy.ON_DEMAND) // Override per-call
|
|
340
|
+
.show { /* next action */ }
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Best Practices
|
|
346
|
+
|
|
347
|
+
1. **Set strategy once** in Application.onCreate()
|
|
348
|
+
2. **Use HYBRID** as default for most cases
|
|
349
|
+
3. **Use ONLY_CACHE** for frequent interruptions (games, navigation)
|
|
350
|
+
4. **Use ON_DEMAND** for critical monetization moments
|
|
351
|
+
5. **Enable background preloading** for ONLY_CACHE/HYBRID
|
|
352
|
+
6. **Monitor ad coverage** and adjust strategy based on metrics
|
|
353
|
+
7. **Different strategies** for different ad types is okay
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## Testing Strategies
|
|
358
|
+
|
|
359
|
+
```kotlin
|
|
360
|
+
// For development/testing
|
|
361
|
+
if (BuildConfig.DEBUG) {
|
|
362
|
+
// Quick testing - only cached ads
|
|
363
|
+
AdManageKitConfig.interstitialLoadingStrategy = AdLoadingStrategy.ONLY_CACHE
|
|
364
|
+
AdManageKitConfig.testMode = true
|
|
365
|
+
} else {
|
|
366
|
+
// Production - balanced approach
|
|
367
|
+
AdManageKitConfig.interstitialLoadingStrategy = AdLoadingStrategy.HYBRID
|
|
368
|
+
}
|
|
369
|
+
```
|