Admob banner and interstitial ads not loading on launcher activity

浪尽此生 提交于 2019-12-18 06:43:13

问题


The first time when I load my app the banner ad and the full screen interstitial ad does not load. Every other time when i hit that (or any other) Activity the ads load fine. This leads me to believe that its not a fill issue. Also i am not using any mediation, just the standard Admob network.

Below is the code i use to load the banner ad

AdView bannerAdView = (AdView)this.findViewById(R.id.adView);
    if (Settings.SHOW_ADS) {
        AdRequest adRequestBanner = new AdRequest.Builder().build();
        bannerAdView.loadAd(adRequestBanner);
    }

Log cat reports back the following error

10-11 21:33:51.749  19409-19439/ W/Ads﹕ There was a problem getting an ad response. ErrorCode: 0
10-11 21:33:51.839  19409-19409/ W/Ads﹕ Failed to load ad: 0
10-11 21:33:47.039  19409-19409/ E/Ads﹕ JS: Uncaught ReferenceError: AFMA_ReceiveMessage is not defined (:1)

Is there anything i can do to make the ad load close to 100% of the time, especially the full screen ad?


回答1:


Also Your package might be blocked by Google AdMob. If you received a email like this:

Hello,

This email is to alert you that one of your applications is not currently in compliance with our AdMob program policies and as a result, ad serving has been disabled to your application.

Issue ID#: 33943***

Ad serving has been disabled to: APPNAME (com.example.pack)

Action required: Check all other remaining applications in your account for compliance.

Current account status: Active

Violation explanation

GOOGLE PLAY REMOVAL: AdMob publishers are not permitted to abuse or promote the abuse of any Google product, such as Google Play, YouTube, or Blogger. This includes circumventing, or providing the means to circumvent, the policies or terms of these or other Google products, such as by allowing users to download YouTube videos.

If your app is removed by Google Play policy enforcement, please contact Google Play about an app removal here. If Google Play reinstates your app, please submit an appeal to our team.

Action required: Check account for compliance

While ad serving has been disabled to the above app, your AdMob account remains active. We suggest that you take the time to review the rest of your applications to ensure that they’re in compliance with our policies, and to monitor your apps accordingly to reduce the likelihood of future policy emails from us. Additionally, please note that our team reserves the right to disable accounts at any time if we continue to see violations occurring.

Appeals

If you wish to appeal this disabling then you can do so by using our appeal form.

Thank you for your cooperation.

Sincerely,

The Google AdMob Team

So now you need to change your package of your app. on eclipse it is package="com.example" in AndroidManifest.xml file

or

on AndroidStudio applicationId "com.example" in build.gradle file




回答2:


My best guess is that your Activity loads faster than the Ad. So the Ad isn't ready by the time your activity loads and so the ad doesn't show. Here is a screenshot of my LogCat showing you the different steps the Ad takes to get ready.

Also, if the Ad is showing and another Activity (Activity B) is called, then Activity B will override the Ad. You can see that the Ad is still on the stack by pushing the back button on your phone/emulator. Pushing that button should return u back to the Ad.




回答3:


This issue has disappeared when upgrading to the latest google play services lib in my Gradle file.

At the time of writing this, the latest version is 6.1.71 and the dependancy looks like this:

compile 'com.google.android.gms:play-services:6.1.71'



回答4:


Check paddingLeft, paddingRight in main layout if present try to remove them. Have similar problem that fixed with padding remove.




回答5:


If you are trying to test ads using adMobs, you need to use the test ad id which is : ca-app-pub-3940256099942544/6300978111.

If you are displaying a test ad and using your private Ad id, it won't work.



来源:https://stackoverflow.com/questions/26313488/admob-banner-and-interstitial-ads-not-loading-on-launcher-activity

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!