This document describes the AdMob integration in the ReshmeInfo app, including setup, testing, and production deployment instructions.
The app uses Google Mobile Ads (AdMob) to display:
- Banner Ads - At the bottom of all main screens (Home, Market, Stats, About)
- Interstitial Ads - Shown occasionally (30% chance) when users switch between tabs
- Android:
ca-app-pub-3940256099942544~3347511713 - Location:
app.config.js→plugins→react-native-google-mobile-ads
The app uses Google's official test ad unit IDs:
- Banner Ad:
TestIds.ADAPTIVE_BANNER - Interstitial Ad:
TestIds.INTERSTITIAL
These are automatically provided by react-native-google-mobile-ads package for testing.
/components
├── AdBanner.tsx # Banner ad component (used in all screens)
/hooks
├── useInterstitialAd.ts # Hook for managing interstitial ads
/screens
├── HomeScreen.tsx # Has banner ad
├── MarketScreen.tsx # Has banner ad
├── StatsScreen.tsx # Has banner ad
└── AboutScreen.tsx # Has banner ad
App.tsx # Initializes AdMob & shows interstitial ads
app.config.js # AdMob plugin configuration
- Build the app with EAS Build or local build (Expo Go doesn't support AdMob)
- Install on a physical Android device or emulator
# For development build
eas build --profile development --platform android
# For preview build
eas build --profile preview --platform android- Open the app
- Navigate to Home screen → Banner ad should appear at bottom
- Navigate to Market screen → Banner ad should appear at bottom
- Navigate to Stats screen → Banner ad should appear at bottom
- Navigate to About screen → Banner ad should appear at bottom
- Verify ads don't overlap with content
- Verify ads are above the tab bar navigation
- Switch between tabs multiple times
- Approximately 30% of tab switches should show a full-screen interstitial ad
- Verify ad can be closed after a few seconds
- Verify navigation continues after ad is closed
- Check console logs for "Tab changed..." messages
Test ads should show:
- Banner: "Test Ad" label
- Interstitial: Full-screen test ad with clear test indication
// Successful initialization
"AdMob initialized: [adapter statuses]"
// Banner ad loaded
"Banner ad loaded successfully"
// Banner ad failed
"Banner ad failed to load: [error]"
// Interstitial ad loaded
"Interstitial ad loaded successfully"
// Interstitial ad shown
"Tab changed from Home to Market, showing interstitial ad"
// Interstitial ad closed
"Interstitial ad closed"- Go to AdMob Console
- Create a new AdMob account (if not already created)
- Add your app: Apps → Add App → Android
- Fill in app details:
- App name: ReshmeInfo
- Package name:
com.master.reshmeinfo - Select "No" for "Is this app published on Google Play?" (if not yet published)
- In AdMob Console → Apps → Your App → Ad units
- Click "Add Ad Unit" → Select "Banner"
- Name: "ReshmeInfo Banner"
- Copy the ad unit ID (format:
ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY)
- Click "Add Ad Unit" → Select "Interstitial"
- Name: "ReshmeInfo Interstitial"
- Copy the ad unit ID
plugins: [
[
"react-native-google-mobile-ads",
{
androidAppId: "ca-app-pub-XXXXXXXXXXXXXXXX~ZZZZZZZZZZ", // Your AdMob App ID
}
]
]// Replace this line:
const TEST_AD_UNIT_ID = TestIds.ADAPTIVE_BANNER;
// With your production ad unit ID:
const PRODUCTION_AD_UNIT_ID = 'ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY';
// And update the component to use it:
const finalAdUnitId = adUnitId || PRODUCTION_AD_UNIT_ID;// Replace this line:
const TEST_AD_UNIT_ID = TestIds.INTERSTITIAL;
// With your production ad unit ID:
const PRODUCTION_AD_UNIT_ID = 'ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY';
// And update the hook to use it:
const adUnitId = options?.adUnitId || PRODUCTION_AD_UNIT_ID;- Add your test device ID to AdMob console to avoid invalid traffic
- Never click your own ads in production mode
- Use test devices registered in AdMob console
// In App.tsx, update AdMob initialization:
MobileAds()
.initialize()
.then(adapterStatuses => {
console.log('AdMob initialized:', adapterStatuses);
});
// Configure test device (optional, for testing production ads safely)
MobileAds().setRequestConfiguration({
testDeviceIdentifiers: ['YOUR_DEVICE_ID_HERE'],
});To get your device ID, check the logs when the app first loads with production ad units.
# Build production version
eas build --profile production --platform android
# Or update existing build
eas update- Placement: Bottom of screen, above tab navigation
- Type: Adaptive banner (automatically adjusts to screen width)
- Frequency: Always visible on all main screens
- User Experience: Non-intrusive, doesn't block content
- Placement: Between tab navigation transitions
- Frequency: 30% of tab switches (configurable in
App.tsx) - User Experience: Occasional, not annoying
- Timing: Only when ad is loaded and user navigates
In App.tsx, line 180:
// Current: 30% chance
if (currentRoute && currentRoute !== previousRoute && isLoaded && Math.random() < 0.3) {
// More frequent (50%):
if (currentRoute && currentRoute !== previousRoute && isLoaded && Math.random() < 0.5) {
// Less frequent (10%):
if (currentRoute && currentRoute !== previousRoute && isLoaded && Math.random() < 0.1) {
// Always show:
if (currentRoute && currentRoute !== previousRoute && isLoaded) {
// Never show (disable):
if (false) {- Check console for "Banner ad failed to load" errors
- Verify app is built (not running in Expo Go)
- Verify internet connection
- Check AdMob account status (not disabled)
- For production: Verify ad unit IDs are correct
- Check console for "Interstitial ad loaded successfully"
- If loaded but not showing, increase frequency (change 0.3 to 1.0)
- Verify navigation state changes are being tracked
- Check if ad is being blocked by device settings
- Normal for test ads occasionally
- For production: May take 24-48 hours for ads to start serving
- Verify payment and tax info in AdMob account
- Rebuild the app after updating
app.config.js - Run
eas buildagain (app.config changes require rebuild)
- Normal for test environment
- For production: Increase ad mediation sources in AdMob
- Ad Placement: Keep banner ads visible but not intrusive
- Interstitial Frequency: Balance revenue vs user experience (30% is recommended)
- User Retention: Monitor if interstitial ads affect user retention
- Ad Mediation: Configure ad mediation in AdMob for higher fill rates
- Analytics: Track ad performance in AdMob dashboard
The app requests non-personalized ads by default:
requestOptions={{
requestNonPersonalizedAdsOnly: true,
}}For GDPR-compliant regions (EU), consider:
- Adding consent collection using Google's UMP SDK
- Only showing personalized ads after user consent
- Providing clear privacy policy
Before publishing:
- Add AdMob privacy policy to app listing
- Declare ad network usage in privacy section
- Include "Contains ads" in app description
- AdMob Console: https://apps.admob.com/
- AdMob Help: https://support.google.com/admob
- react-native-google-mobile-ads Docs: https://docs.page/invertase/react-native-google-mobile-ads
- Expo AdMob Guide: https://docs.expo.dev/versions/latest/sdk/admob/
For issues with this implementation:
- Check console logs first
- Verify AdMob dashboard for account status
- Review this documentation for troubleshooting steps
- Contact development team with specific error messages
Last Updated: 2025-10-18 Version: 1.0.0 (Test Mode) Status: ✅ Ready for testing