The problem
There is no way to display in-app ads in Perry-compiled iOS/Android apps. Advertising is the most common monetization strategy for free apps, but Perry currently has no bridge to any ad network SDK (AdMob, Unity Ads, AppLovin MAX, ironSource, etc.).
The only workarounds today are:
- V8 interop (adds ~15–48 MB to binary, no guarantee of SDK compatibility)
- Manual FFI bindings (complex, unsupported, requires per-network work)
Neither is practical for a developer who just wants to ship a free app with banner or interstitial ads.
Proposed solution
A first-party perry/ads package with FFI bindings to the Google Mobile Ads SDK (iOS/Android) as an initial target, following the same native-binding pattern related to #537 (StoreKit 2 / Play Billing) and #95 (APNs/FCM push).
import { AdBanner, AdInterstitial, AdRewarded, AdSize } from 'perry/ads'
// Banner ad
App({
body: VStack(0, [
MyContent(),
AdBanner({ unitId: 'ca-app-pub-xxx/yyy', size: AdSize.Banner }),
])
})
// Interstitial ad
const interstitial = await AdInterstitial.load('ca-app-pub-xxx/yyy')
button.onPress(() => interstitial.show())
// Rewarded ad
const rewarded = await AdRewarded.load('ca-app-pub-xxx/yyy')
rewarded.onEarnedReward((reward) => giveCoins(reward.amount))
rewarded.show()
Alternatives considered
- V8 interop with JS ad SDK: Too heavy, and ad SDKs require native SDK registration (Info.plist / AndroidManifest) which V8 interop alone can't handle cleanly.
- User-side FFI: Requires deep knowledge of Perry internals and per-network implementation. Not viable for typical users.
- WebView-based ads: perry/ui has no WebView widget, so this is not an option.
Scope
(Requires FFI bindings to native SDKs on both iOS and Android, plus perry.toml / Info.plist / AndroidManifest integration for App ID registration. GDPR/ATT consent handling will also be needed.)
Additional context
The problem
There is no way to display in-app ads in Perry-compiled iOS/Android apps. Advertising is the most common monetization strategy for free apps, but Perry currently has no bridge to any ad network SDK (AdMob, Unity Ads, AppLovin MAX, ironSource, etc.).
The only workarounds today are:
Neither is practical for a developer who just wants to ship a free app with banner or interstitial ads.
Proposed solution
A first-party
perry/adspackage with FFI bindings to the Google Mobile Ads SDK (iOS/Android) as an initial target, following the same native-binding pattern related to #537 (StoreKit 2 / Play Billing) and #95 (APNs/FCM push).Alternatives considered
Scope
(Requires FFI bindings to native SDKs on both iOS and Android, plus
perry.toml/Info.plist/AndroidManifestintegration for App ID registration. GDPR/ATT consent handling will also be needed.)Additional context
google_mobile_adsreact-native-google-mobile-ads