AdMob No ads appear

0

I did everything right: I linked the app with the firebase, but at the time of running the ad area it turns white. Now if I use the test unit id it works normally

MainActivity Code

    AdView mAdView = (AdView) findViewById(R.id.adView);

    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);

Layout code

   <com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="368dp"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="@string/banner_ad_unit_id"
    tools:layout_editor_absoluteY="8dp"
    tools:layout_editor_absoluteX="8dp">
    </com.google.android.gms.ads.AdView>

Strings

<resources>
<string name="app_name">My Application</string>
<string name="banner_ad_unit_id">ca-app-pub-
 1770401303076452/1027518523</string>
 </resources>
    
asked by anonymous 22.03.2017 / 03:26

2 answers

0

If you just created the ad in admob, it takes a while for the ad to start running. And if you are using android studio emulator, only test ad will appear, even you using normal ad.

    
22.03.2017 / 05:24
0
  

Only when running the ad area is white

Test directly on the device or to test with emulators, you can try this:

AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
  

Now it appeared normal, but the click counter of the site   admob does not exit 0

Usually will upgrade the next day. It's not quite real-time like Google Analytics.

  

AdView mAdView = (AdView) findViewById (R.id.adView);

On this line, I believe that your Android Studio is outdated, as there is no longer any need to cast more. Try to always keep your IDE up to date because sometimes some bugs are solved by that alone.

    
22.01.2018 / 11:40