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,413 @@
1
+ # NativeTemplateView Guide
2
+
3
+ **New in v2.6.0** - A unified native ad component supporting 28 different template styles with Material 3 theming and video support.
4
+
5
+ ## Overview
6
+
7
+ `NativeTemplateView` is a single, flexible component that replaces the need for multiple native ad views. It supports 28 different visual templates that can be set via XML attributes or programmatically.
8
+
9
+ ## Features
10
+
11
+ - **28 Template Styles**: From minimal to icon-left, compact to fullscreen video
12
+ - **Material 3 Theming**: Automatic dark/light mode support
13
+ - **Video Support**: All templates support video ads (120dp+ MediaView)
14
+ - **Shimmer Loading**: Beautiful loading animation
15
+ - **XML Preview**: See actual template in Android Studio designer
16
+ - **Smart View Handling**: Auto-hide empty containers, proper alignment
17
+ - **AdChoices Support**: Automatic visibility handling
18
+ - **Caching Integration**: Works with NativeAdManager caching system
19
+ - **Loading Strategy Support**: ON_DEMAND, ONLY_CACHE, or HYBRID
20
+
21
+ ## Available Templates
22
+
23
+ ### Standard Templates
24
+
25
+ | Template | Enum Value | Description |
26
+ |----------|-----------|-------------|
27
+ | Card Modern | `CARD_MODERN` | Modern card with rounded corners - general purpose |
28
+ | Material 3 | `MATERIAL3` | Material Design 3 style with M3 components |
29
+ | Minimal | `MINIMAL` | Clean, minimal design for content-focused apps |
30
+ | Compact Horizontal | `COMPACT_HORIZONTAL` | Horizontal layout, 120dp height |
31
+ | Story Style | `STORY_STYLE` | Story/feed style for social apps |
32
+ | Full Width Banner | `FULL_WIDTH_BANNER` | Full-width banner style |
33
+ | Grid Card | `GRID_CARD` | Square card for grid layouts |
34
+ | List Item | `LIST_ITEM` | List item style with divider |
35
+ | Featured | `FEATURED` | Large featured card for hero sections |
36
+ | Overlay Dark | `OVERLAY_DARK` | Dark overlay on media |
37
+ | Magazine | `MAGAZINE` | Magazine article style for news/blog apps |
38
+ | Media Content Split | `MEDIA_CONTENT_SPLIT` | Media/content split layout |
39
+ | App Store | `APP_STORE` | Store listing style with install CTA |
40
+ | Social Feed | `SOCIAL_FEED` | Sponsored post layout for feeds |
41
+ | Gradient Card | `GRADIENT_CARD` | Hero card with gradient overlay |
42
+ | Pill Banner | `PILL_BANNER` | Pill-shaped compact banner |
43
+ | Medium Horizontal | `MEDIUM_HORIZONTAL` | 55/45 media-content horizontal split |
44
+ | Spotlight | `SPOTLIGHT` | Centered hero with large icon |
45
+ | Flexible | `FLEXIBLE` | Adaptive card with media focus |
46
+ | Grid Item | `GRID_ITEM` | Compact grid item with centered content |
47
+ | Top Icon Media | `TOP_ICON_MEDIA` | Top icon + headline, media center, CTA footer |
48
+ | Icon Left | `ICON_LEFT` | Left icon column with stacked content |
49
+
50
+ ### Video Templates
51
+
52
+ | Template | Enum Value | Description |
53
+ |----------|-----------|-------------|
54
+ | Video Small | `VIDEO_SMALL` | Small video-optimized (120x120dp) |
55
+ | Video Medium | `VIDEO_MEDIUM` | Medium video-optimized (180dp) |
56
+ | Video Large | `VIDEO_LARGE` | Large video-optimized (250dp) |
57
+ | Video Square | `VIDEO_SQUARE` | Square format (300x300dp) |
58
+ | Video Vertical | `VIDEO_VERTICAL` | Vertical format (9:16 ratio) |
59
+ | Video Fullscreen | `VIDEO_FULLSCREEN` | Fullscreen video ad |
60
+
61
+ ## XML Usage
62
+
63
+ ### Basic Usage
64
+
65
+ ```xml
66
+ <com.i2hammad.admanagekit.admob.NativeTemplateView
67
+ android:id="@+id/nativeTemplateView"
68
+ android:layout_width="match_parent"
69
+ android:layout_height="wrap_content"
70
+ app:adTemplate="card_modern" />
71
+ ```
72
+
73
+ ### All Template Options
74
+
75
+ ```xml
76
+ <!-- Standard templates -->
77
+ app:adTemplate="card_modern"
78
+ app:adTemplate="material3"
79
+ app:adTemplate="minimal"
80
+ app:adTemplate="compact_horizontal"
81
+ app:adTemplate="story_style"
82
+ app:adTemplate="full_width_banner"
83
+ app:adTemplate="grid_card"
84
+ app:adTemplate="list_item"
85
+ app:adTemplate="featured"
86
+ app:adTemplate="overlay_dark"
87
+ app:adTemplate="magazine"
88
+ app:adTemplate="media_content_split"
89
+ app:adTemplate="app_store"
90
+ app:adTemplate="social_feed"
91
+ app:adTemplate="gradient_card"
92
+ app:adTemplate="pill_banner"
93
+ app:adTemplate="medium_horizontal"
94
+ app:adTemplate="spotlight"
95
+ app:adTemplate="flexible"
96
+ app:adTemplate="grid_item"
97
+ app:adTemplate="top_icon_media"
98
+ app:adTemplate="icon_left"
99
+
100
+ <!-- Video templates -->
101
+ app:adTemplate="video_small"
102
+ app:adTemplate="video_medium"
103
+ app:adTemplate="video_large"
104
+ app:adTemplate="video_square"
105
+ app:adTemplate="video_vertical"
106
+ app:adTemplate="video_fullscreen"
107
+ ```
108
+
109
+ ### In RecyclerView
110
+
111
+ ```xml
112
+ <!-- item_native_ad.xml -->
113
+ <com.i2hammad.admanagekit.admob.NativeTemplateView
114
+ android:id="@+id/nativeTemplateView"
115
+ android:layout_width="match_parent"
116
+ android:layout_height="wrap_content"
117
+ app:adTemplate="list_item" />
118
+ ```
119
+
120
+ ## Programmatic Usage
121
+
122
+ ### Basic Loading
123
+
124
+ ```kotlin
125
+ // Simple load with default template
126
+ nativeTemplateView.loadNativeAd(activity, "ca-app-pub-xxx/yyy")
127
+ ```
128
+
129
+ ### Setting Template Programmatically
130
+
131
+ ```kotlin
132
+ // Using enum
133
+ nativeTemplateView.setTemplate(NativeAdTemplate.MAGAZINE)
134
+ nativeTemplateView.loadNativeAd(activity, adUnitId)
135
+
136
+ // Using string
137
+ nativeTemplateView.setTemplate("material3")
138
+ nativeTemplateView.loadNativeAd(activity, adUnitId)
139
+ ```
140
+
141
+ ### With Callback
142
+
143
+ ```kotlin
144
+ nativeTemplateView.loadNativeAd(activity, adUnitId, object : AdLoadCallback() {
145
+ override fun onAdLoaded() {
146
+ Log.d("Ad", "Native ad loaded successfully")
147
+ }
148
+
149
+ override fun onFailedToLoad(error: AdError?) {
150
+ Log.e("Ad", "Failed to load: ${error?.message}")
151
+ }
152
+
153
+ override fun onAdImpression() {
154
+ Log.d("Ad", "Ad impression recorded")
155
+ }
156
+
157
+ override fun onAdClicked() {
158
+ Log.d("Ad", "Ad clicked")
159
+ }
160
+ })
161
+ ```
162
+
163
+ ### With Loading Strategy Override
164
+
165
+ ```kotlin
166
+ // Override the global loading strategy for this specific ad
167
+ nativeTemplateView.loadNativeAd(
168
+ activity = activity,
169
+ adUnitId = "ca-app-pub-xxx/yyy",
170
+ adCallback = myCallback,
171
+ loadingStrategy = AdLoadingStrategy.ONLY_CACHE
172
+ )
173
+ ```
174
+
175
+ ### Display Preloaded Ad
176
+
177
+ ```kotlin
178
+ // Get a cached ad
179
+ val preloadedAd = NativeAdManager.getCachedNativeAd("ad-unit-id")
180
+
181
+ // Display it in the template view
182
+ preloadedAd?.let { nativeAd ->
183
+ nativeTemplateView.displayAd(nativeAd)
184
+ }
185
+ ```
186
+
187
+ ### Utility Methods
188
+
189
+ ```kotlin
190
+ // Get current template
191
+ val currentTemplate = nativeTemplateView.getTemplate()
192
+
193
+ // Hide ad
194
+ nativeTemplateView.hideAd()
195
+
196
+ // Show ad
197
+ nativeTemplateView.showAd()
198
+
199
+ // Get all available template names
200
+ val templates = NativeTemplateView.getAvailableTemplates()
201
+
202
+ // Get video template names
203
+ val videoTemplates = NativeTemplateView.getVideoTemplates()
204
+
205
+ // Get standard (non-video) template names
206
+ val standardTemplates = NativeTemplateView.getStandardTemplates()
207
+ ```
208
+
209
+ ## Jetpack Compose Usage
210
+
211
+ NativeTemplateView is also available as a Compose component via the `ad-manage-kit-compose` module.
212
+
213
+ ### Basic Compose Usage
214
+
215
+ ```kotlin
216
+ @Composable
217
+ fun MyScreen() {
218
+ NativeTemplateCompose(
219
+ adUnitId = "ca-app-pub-xxx/yyy",
220
+ template = NativeAdTemplate.CARD_MODERN,
221
+ onAdLoaded = { println("Ad loaded") }
222
+ )
223
+ }
224
+ ```
225
+
226
+ ### With Loading Strategy
227
+
228
+ ```kotlin
229
+ @Composable
230
+ fun MyScreen() {
231
+ NativeTemplateCompose(
232
+ adUnitId = "ca-app-pub-xxx/yyy",
233
+ template = NativeAdTemplate.MATERIAL3,
234
+ loadingStrategy = AdLoadingStrategy.HYBRID,
235
+ onAdLoaded = { /* success */ },
236
+ onAdFailedToLoad = { error -> /* handle error */ }
237
+ )
238
+ }
239
+ ```
240
+
241
+ ### Convenience Functions
242
+
243
+ ```kotlin
244
+ // Use specific templates directly
245
+ NativeCardModernCompose(adUnitId = adUnitId)
246
+ NativeMaterial3Compose(adUnitId = adUnitId)
247
+ NativeMinimalCompose(adUnitId = adUnitId)
248
+ NativeCompactHorizontalCompose(adUnitId = adUnitId)
249
+ NativeListItemCompose(adUnitId = adUnitId)
250
+ NativeMagazineCompose(adUnitId = adUnitId)
251
+ NativeFeaturedCompose(adUnitId = adUnitId)
252
+ NativeVideoMediumCompose(adUnitId = adUnitId)
253
+ NativeVideoLargeCompose(adUnitId = adUnitId)
254
+ NativeVideoSquareCompose(adUnitId = adUnitId)
255
+ ```
256
+
257
+ ### In LazyColumn
258
+
259
+ ```kotlin
260
+ @Composable
261
+ fun AdFeed() {
262
+ LazyColumn {
263
+ items(contentItems) { item ->
264
+ ContentItem(item)
265
+ }
266
+
267
+ item {
268
+ NativeListItemCompose(
269
+ adUnitId = "ca-app-pub-xxx/yyy",
270
+ loadingStrategy = AdLoadingStrategy.ONLY_CACHE // Best for scrolling
271
+ )
272
+ }
273
+ }
274
+ }
275
+ ```
276
+
277
+ For full Compose documentation, see [COMPOSE_INTEGRATION.md](COMPOSE_INTEGRATION.md).
278
+
279
+ ## Material 3 Theme Support
280
+
281
+ All templates use Material 3 theme attributes for automatic dark/light mode support:
282
+
283
+ | Attribute | Usage |
284
+ |-----------|-------|
285
+ | `?attr/colorSurface` | Background |
286
+ | `?attr/colorOnSurface` | Primary text |
287
+ | `?attr/colorOnSurfaceVariant` | Secondary text |
288
+ | `?attr/colorPrimary` | CTA button background |
289
+ | `?attr/colorOutlineVariant` | Borders, dividers |
290
+ | `?attr/colorSurfaceVariant` | Chips, badges |
291
+
292
+ No additional configuration needed - templates automatically adapt to your app's theme.
293
+
294
+ ## View Handling
295
+
296
+ ### Smart Visibility
297
+
298
+ Views use `GONE` (not `INVISIBLE`) when content is missing:
299
+ - Body text: Hidden if null
300
+ - Advertiser: Hidden if null
301
+ - Star rating: Hidden if null or 0
302
+ - Icon: Hidden if null
303
+ - Media: Hidden if null
304
+ - CTA: Hidden if null
305
+
306
+ ### Container Auto-Hide
307
+
308
+ The advertiser container (containing advertiser name and rating) is automatically hidden when both advertiser and rating are missing, ensuring proper layout alignment.
309
+
310
+ ### AdChoices
311
+
312
+ AdChoices view is automatically shown when present in the template. The SDK populates it automatically via `setNativeAd()`.
313
+
314
+ ## Integration with Caching
315
+
316
+ NativeTemplateView integrates with `NativeAdManager` and `NativeAdIntegrationManager`:
317
+
318
+ ```kotlin
319
+ // Enable global caching
320
+ NativeAdManager.enableCachingNativeAds = true
321
+
322
+ // Ads are automatically cached when loaded
323
+ nativeTemplateView.loadNativeAd(activity, adUnitId)
324
+
325
+ // Use cached ads later
326
+ val cached = NativeAdManager.getCachedNativeAd(adUnitId)
327
+ cached?.let { nativeTemplateView.displayAd(it) }
328
+ ```
329
+
330
+ ## Screen Type Mapping
331
+
332
+ Templates are automatically mapped to screen types for caching:
333
+
334
+ | Templates | Screen Type |
335
+ |-----------|-------------|
336
+ | COMPACT_HORIZONTAL, FULL_WIDTH_BANNER, LIST_ITEM, GRID_CARD, GRID_ITEM, MEDIA_CONTENT_SPLIT, PILL_BANNER, VIDEO_SMALL | SMALL |
337
+ | CARD_MODERN, MATERIAL3, MINIMAL, APP_STORE, MEDIUM_HORIZONTAL, TOP_ICON_MEDIA, ICON_LEFT, FLEXIBLE, VIDEO_MEDIUM, VIDEO_SQUARE | MEDIUM |
338
+ | STORY_STYLE, FEATURED, OVERLAY_DARK, MAGAZINE, SOCIAL_FEED, GRADIENT_CARD, SPOTLIGHT, VIDEO_LARGE, VIDEO_VERTICAL, VIDEO_FULLSCREEN | LARGE |
339
+
340
+ ## XML Preview
341
+
342
+ In Android Studio's XML designer, `NativeTemplateView` shows the actual template layout with placeholder data (not shimmer), allowing you to see how the ad will appear in your layout.
343
+
344
+ ## Migration from Individual Views
345
+
346
+ ### From NativeBannerSmall
347
+
348
+ ```kotlin
349
+ // Before
350
+ val nativeBannerSmall = NativeBannerSmall(context)
351
+ nativeBannerSmall.loadNativeBannerAd(activity, adUnitId)
352
+
353
+ // After
354
+ val nativeTemplateView = NativeTemplateView(context)
355
+ nativeTemplateView.setTemplate(NativeAdTemplate.COMPACT_HORIZONTAL)
356
+ nativeTemplateView.loadNativeAd(activity, adUnitId)
357
+ ```
358
+
359
+ ### From NativeBannerMedium
360
+
361
+ ```kotlin
362
+ // Before
363
+ val nativeBannerMedium = NativeBannerMedium(context)
364
+ nativeBannerMedium.loadNativeBannerAd(activity, adUnitId)
365
+
366
+ // After
367
+ val nativeTemplateView = NativeTemplateView(context)
368
+ nativeTemplateView.setTemplate(NativeAdTemplate.CARD_MODERN)
369
+ nativeTemplateView.loadNativeAd(activity, adUnitId)
370
+ ```
371
+
372
+ ### From NativeLarge
373
+
374
+ ```kotlin
375
+ // Before
376
+ val nativeLarge = NativeLarge(context)
377
+ nativeLarge.loadNativeAds(activity, adUnitId)
378
+
379
+ // After
380
+ val nativeTemplateView = NativeTemplateView(context)
381
+ nativeTemplateView.setTemplate(NativeAdTemplate.FEATURED)
382
+ nativeTemplateView.loadNativeAd(activity, adUnitId)
383
+ ```
384
+
385
+ ## Best Practices
386
+
387
+ 1. **Choose the right template** for your layout context
388
+ 2. **Use video templates** when expecting video ads for better UX
389
+ 3. **Set template via XML** when possible for XML preview support
390
+ 4. **Enable caching** for better performance with `NativeAdManager.enableCachingNativeAds = true`
391
+ 5. **Use ONLY_CACHE strategy** in RecyclerViews for smooth scrolling
392
+ 6. **Handle callbacks** to show placeholder content on failure
393
+
394
+ ## Troubleshooting
395
+
396
+ ### Ad Not Displaying
397
+
398
+ 1. Check if ad unit ID is correct
399
+ 2. Verify purchase status (ads hidden for purchased users)
400
+ 3. Check for ad loading errors in callback
401
+ 4. Ensure activity is not finishing/destroyed
402
+
403
+ ### Wrong Template Showing
404
+
405
+ 1. Verify `app:adTemplate` attribute in XML
406
+ 2. Check `setTemplate()` is called before `loadNativeAd()`
407
+ 3. Verify template enum/string spelling
408
+
409
+ ### Theme Colors Wrong
410
+
411
+ 1. Ensure your theme extends a Material 3 theme
412
+ 2. Check theme attribute definitions in `themes.xml`
413
+ 3. Verify night mode theme is properly configured