Ebube Emeka
Ebube Emeka

Reputation: 21

How to make AdMob real ads work on an Android app

I have created an Android app, but I have serious problems getting real ads to display on a real device. Test ads show up every time, however when I use a real banner ID, nothing displays in the error log except this:

02-09 10:29:50.716 16952-16952/com.example.stupidgeek.news I/Ads: Use AdRequest.Builder.addTestDevice("28E075A3715CDF584BC5657226DBC1A6") to get test ads on this device.

It's been weeks since I created this particular app ID, so it's not a question of waiting for some time. I've never gotten real ads to work at all. Do you have any suggestions?

My MainActivity.java
MobileAds.initialize(MyContext.getContext(), "ca-app-pub-8876847501690636~9092222318");

mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);

mAdView.setAdListener(new AdListener() {

    @Override
    public void onAdFailedToLoad(int errorCode) {
        // log the error code
    }
});

My layout:

<com.google.android.gms.ads.AdView
            xmlns:ads="http://schemas.android.com/apk/res-auto"
            android:id="@+id/adView"
            android:layout_width="match_parent"
            android:layout_height="80dp"
            android:layout_centerHorizontal="true"
            android:layout_alignParentBottom= "true"
            ads:adSize="BANNER"
            android:layout_alignParentEnd="true"
            android:layout_below="@id/content"
            ads:adUnitId="ca-app-pub-8876847501690636/9447445538">
</com.google.android.gms.ads.AdView>

Upvotes: 2

Views: 691

Answers (2)

Ebube Emeka
Ebube Emeka

Reputation: 262

Thank you... but I've generated the release version, added my add keys, I've waited four days already, still no show.

Upvotes: 1

ismail alaoui
ismail alaoui

Reputation: 6063

You should never use ads key for debug version , if your ads show with test key works , then use your key and test it on a release apk otherwise your admob account could be blacklisted!

Upvotes: 1

Related Questions