Ads are the part of a Kotlin Multiplatform app that cannot be shared, because the SDKs are native on each side. What can be shared is everything around them: when to show an ad, what happens if there is none, and what the screens are allowed to know. This is how my small Android and iOS apps split that work, with real names from the code.
One small interface in shared code
In Slinglings, the shared module has one interface named GameServices. The shared Compose screens know only this interface and nothing about AdMob. Its members fall into a few groups.
A global holder keeps the current implementation: Services.impl starts as NoServices, an object with no ads, where a rewarded request gives the reward immediately. The Android activity replaces it in onCreate with AndroidServices, which wraps AdMob, UMP, Play Billing and Firebase Analytics. One rule shapes every method: the callback always fires.…