0
votes

Exactly the same problem.
Admob shows Test ads but not real ads
However I cant find any answer to be working.

  1. My app is published for 30 days, ads id is long enough for any wait process.
  2. I set no ppc cap/no limitation. There should be lots.
  3. Tried with the new ads ID. ( Waited for 1 week still nothing)
  4. Test ads work perfectly fine.
  5. No permission in manifest except the meta
    Which permissions should i include when i use admob android
  6. implementation 'com.google.android.gms:play-services-ads:18.2.0'

My guess,
1. something wrong with the 18.2.0 (Previously I failed to compile it using 18.1.0).
2. to include the permission in manifest as per old version.

Anyone to suggest working version of play services ads?

Edit 1: Adding code

TitleActivity.java

MobileAds.initialize(this, new OnInitializationCompleteListener() {
        @Override
        public void onInitializationComplete(InitializationStatus initializationStatus) {
            new Handler().postDelayed(new Runnable(){
                @Override
                public void run() {
                    //Intent intent = new Intent(TitleActivity.this, AllTypes.class);
                    Intent intent = new Intent(TitleActivity.this, QuestionsActivity.class);
                    //Intent intent = new Intent(TitleActivity.this, bkMainActivity.class);
                    TitleActivity.this.startActivity(intent);
                    TitleActivity.this.finish();
                }
            }, delayTime);//1800
            Log.d("Ads", "onInitializationComplete: Initialize complete");
        }
    });

AdsSystem.java

boolean useSampleID = false;    
public void loadInterstitial(Context c){
    //MobileAds.initialize(this,getString(R.string.app_ad_id));

    mInterstitialAd = new InterstitialAd(c);
    if (useSampleID){
        mInterstitialAd.setAdUnitId(interstitialSampleID);
    }else {
        mInterstitialAd.setAdUnitId(String.valueOf(R.string.ad_interstitial_id));
    }
    //load
    mInterstitialAd.loadAd(new AdRequest.Builder().build());
    Log.d("Ads", "The interstitial is loading.");
}

public void showInterstitial(){
    if (mInterstitialAd.isLoaded()) {
        mInterstitialAd.show();
        // Set an AdListener.
        mInterstitialAd.setAdListener(new AdListener() {
            @Override
            public void onAdClosed () {
                AdRequest adRequest = new AdRequest.Builder().build();
                mInterstitialAd.loadAd(adRequest);
                Log.d("Ads", "The interstitial is loading.");
            }
        });
        Log.d("Ads", "The interstitial is showing.");
    } else {
        Log.d("Ads", "The interstitial wasn't loaded yet.");
    }
}

Will call load and show alternatively in MainActivity.

Edit 2 Added logcat from real device

2019-11-19 21:17:43.346 17702-17702/tk.myessentialoils.a16personalities 
I/Ads: This request is sent from a test device.
2019-11-19 21:17:43.392 17702-17702/tk.myessentialoils.a16personalities     
I/DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21001
2019-11-19 21:17:43.392 17702-17702/tk.myessentialoils.a16personalities I/DynamiteModule: Selected remote version of com.google.android.gms.ads.dynamite, version >= 21001
2019-11-19 21:17:43.435 17702-17702/tk.myessentialoils.a16personalities D/Ads: The interstitial is loading.
2019-11-19 21:17:43.567 17702-17803/tk.myessentialoils.a16personalities W/Ads: Not retrying to fetch app settings
2019-11-19 21:17:45.111 2371-15333/? E/Ads: Cannot determine request type. Is your ad unit id correct?
2019-11-19 21:17:46.684 17702-17702/tk.myessentialoils.a16personalities I/Ads: Ad failed to load : 1
1
add the code snippet that you used to load adstouhid udoy
"You will have to wait whilst Admob evaluates/checks your traffic for quality and quantity. This can take a while in their system and this check can happen/re-happen at any time (Normally at the start of someone's account) If you are seeing adverts whilst in test mode then you usually have implemented the adverts correctly in your app." answer from support.google.com/admob/thread/3150336?hl=enOMi Shah
I am an old user of admob, my app had been published with new users for 1 month. There should be more than 100 request with different ip. So I don't think this is the reason for it.Tony Ming

1 Answers

0
votes

For those who viewed the question.

There are something wrong with this line

mInterstitialAd.setAdUnitId(String.valueOf(R.string.ad_interstitial_id));

When substituting the id with actual string.

mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/6300978111");

The ads now work.
PS: The ads unit id used in this answer is a sample.

Feel free to discuss what is wrong with that line. Lol. I always found them interesting, where a code was usable 1 month ago, now cannot be used due to some update on google.