Skip to content

googleMobileAds()

function googleMobileAds(): HookExtension<HookEvent<"sdkMissing", Record<string, never>>>;

Registers the WebView with the Google Mobile Ads SDK, Google's WebView API for Ads (Android, iOS), so that AdSense and Ad Manager ads on the page get the app's signals.

This package doesn't include the SDK: add it to the app, for example with react-native-google-mobile-ads, and set it up as Google's page says. Without it, the WebView isn't registered and this logs a console.error.

Turn it on when the WebView is created: Google requires the WebView to be registered before it loads anything, so the hook registers it then. Turned on later, the core warns and it does nothing.

Google also asks for video autoplay without a tap, which is off by default: set android.settings.mediaPlaybackRequiresUserGesture to false, and ios.configuration.mediaTypesRequiringUserActionForPlayback to IOSConstants.AudiovisualMediaTypes.none. The other settings it lists are on by default.

Returns

HookExtension<HookEvent<"sdkMissing", Record<string, never>>>