sbugert / react-native-admob

A react-native component for Google AdMob banners
BSD 2-Clause "Simplified" License
1.13k stars 532 forks source link

Test Ad Does Not Show #497

Open madelinemckune opened 4 years ago

madelinemckune commented 4 years ago

This is my first RN app and I wanted to use the Admob library to monetize my app. However, I cannot see ANY ads (yes, including the test ad) in my emulator. I am using RN -v 0.60.5. Any help is appreciated since I am just starting with RN!

Steps taken:

  1. added this line to my podfile:

pod 'Google-Mobile-Ads-SDK'

  1. ran inside ios folder

pod install --repo-update

  1. created admob account for iOS app

  2. added to info.plist (with my app id)

<key> GADApplicationIdentifier </key> <string>ca-app-pub-3940256099942544~1458002511</string>

  1. added the lines in AppDelegate.m (with the same app id):

@import GoogleMobileAds; [GADMobileAds configureWithApplicationID:@"ca-app-pub-3940256099942544~1458002511"];

  1. ran:

npm install react-native-admob

  1. cd into ios folder and ran:

pod install

  1. put into my welcome screen:
import {AdMobBanner} from 'react-native-admob'; <AdMobBanner
      adSize="fullBanner"
      adUnitId="ca-app-pub-3940256099942544/2934735716" //test app unit id
      onAdFailedToLoad={error => console.log(error)}
      testDevices={[AdMobBanner.simulatorId]}></AdMobBanner>
  1. ran:

react-native run-ios

  1. Got a banner at the bottom but no ad and an error: "Error: Cannot determine request type. Is your ad unit id correct?"
Tinmania2018 commented 4 years ago

I believe that if you create the account and test immediately after that you receive an error because the account isn't completely known yet. Maybe try after a day?

I'm not sure if this also applies to the test apps because you use a different adUnitId. With my test (a day or two after creating the adMob account) the testcode worked inmediatly with just copying the code from the example.

joshsiegl1 commented 4 years ago

Same things happening for me, @madelinemckune did you come up with a solution for this?

deokgiyun commented 4 years ago

you should change adUnitId to adUnitID.