### Install AdMob Module (Expo) Source: https://docs.page/invertase/react-native-google-mobile-ads Install the admob module and config plugin using npx expo install for Expo projects. ```bash # Install the admob module and config plugin npx expo install react-native-google-mobile-ads ``` -------------------------------- ### Install expo-build-properties Plugin Source: https://docs.page/invertase/react-native-google-mobile-ads/mediation Install the expo-build-properties plugin if you haven't already. This is a prerequisite for adding native dependencies for mediation adapters in Expo projects. ```bash npx expo install expo-build-properties ``` -------------------------------- ### Load and Display a Rewarded Ad with Event Listeners Source: https://docs.page/invertase/react-native-google-mobile-ads/displaying-ads This example demonstrates how to load a rewarded ad, listen for load and earned reward events, and display the ad when the user interacts with a button. It includes setting up event listeners and managing the ad's loaded state. ```javascript import React, { useEffect, useState } from 'react'; import { Button } from 'react-native'; import { RewardedAd, RewardedAdEventType, TestIds } from 'react-native-google-mobile-ads'; const adUnitId = __DEV__ ? TestIds.REWARDED : 'ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyyyyyy'; const rewarded = RewardedAd.createForAdRequest(adUnitId, { keywords: ['fashion', 'clothing'], }); function App() { const [loaded, setLoaded] = useState(false); useEffect(() => { const unsubscribeLoaded = rewarded.addAdEventListener(RewardedAdEventType.LOADED, () => { setLoaded(true); }); const unsubscribeEarned = rewarded.addAdEventListener( RewardedAdEventType.EARNED_REWARD, reward => { console.log('User earned reward of ', reward); }, ); // Start loading the rewarded ad straight away rewarded.load(); // Unsubscribe from events on unmount return () => { unsubscribeLoaded(); unsubscribeEarned(); }; }, []); // No advert ready to show yet if (!loaded) { return null; } return (