Skip to main content
First Look gives CloudX the first chance to fill a placement while preserving your existing mediation setup as the fallback path. Start with one placement, verify load and show behavior, then expand to more placements. This example uses an AdMob interstitial fallback through react-native-google-mobile-ads. The same pattern applies to other fallback mediators: load CloudX first, load the fallback only if CloudX does not load, and keep the app flow moving when neither source is ready.
Initialize CloudX and Google Mobile Ads before using the hook. Keep your existing pacing, retry, and placement timing rules around it.
useFirstLookInterstitial.ts
Call load() when the screen is ready to prepare the placement. At the placement moment, call show(). If it returns false, neither CloudX nor the fallback had a ready ad, so continue the app flow without showing an ad.
GameScreen.tsx
After a show, close, or terminal failure, call load() again when your app is ready to prepare the next placement opportunity. Both underlying hooks release their event subscriptions when the component unmounts; the CloudX hook also destroys its interstitial instance.
This sample keeps the fallback lazy: AdMob loads only after CloudX reports an error. Do not parallel-load both sources unless CloudX recommends a different rollout strategy for your app.