I just open-sourced kmp-ads, a Kotlin Multiplatfor...
# feed
s
I just open-sourced kmp-ads, a Kotlin Multiplatform ads layer for Android and iOS, and it’s now available on Maven Central. The motivation was pretty simple: every time I added AdMob to a KMP app, I ended up rewriting the same platform glue and ad-state logic. kmp-ads moves that into shared code: • Placements and ad policies are data-driven, including frequency caps, warm-up, cooldowns, and premium suppression. • Every ad decision has a reason, e.g.
DailyCapReached(12)
or consent not obtained. • Compose Multiplatform ad slots for banners, native, interstitial, rewarded, rewarded interstitial, and app open ads. • Built-in consent handling with Google's User Messaging Platform on Android and the equivalent flow on iOS. • Debug builds automatically use test ads, and production ad unit IDs are validated at startup. • iOS integration doesn't require exposing native interop throughout the shared code. Add Google Mobile Ads through Swift Package Manager and implement a small Swift protocol. • Testable with a fake provider, controllable clock, and event recorder. It's already the ads layer I use in my own apps. GitHub: github.com/shivathapaa/kmp-ads I'd especially love feedback from people building KMP/CMP apps. I'm interested in whether this abstraction fits how you're handling monetization today, and what you'd want to see added.
🎉 2