Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot display AdMob banners, Received error HTTP response code: 400 etc

Tags:

android

admob

Whatever I do I cannot display the banners from Admob, I tested on two Android different devices and here is what I get:

First device:

I/Ads     ( 8161): Starting ad request.
I/Ads     ( 8161): Please set theme of AdActivity to @android:style/Theme.Translucent to enable transparent background interstitial ad.
I/Ads     ( 1006): CsiReporterFactory: CSI is not enabled. No CSI reporter created.
W/Ads     ( 1006): JS: The page at about:blank displayed insecure content from gmsg://mobileads.google.com/loadAdURL?drt_include=0&request_id=............
W/Ads     ( 1006):  (null:1)
W/Web Console( 1006): The page at about:blank displayed insecure content from gmsg://mobileads.google.com/loadAdURL?drt_include=0&request_id=............
W/Ads     ( 1006): JS: The page at about:blank displayed insecure content from gmsg://mobileads.google.com/loadAdURL?drt_include=0&request_id=............
W/Ads     ( 1006):  (null:1)
W/Web Console( 1006): The page at about:blank displayed insecure content from gmsg://mobileads.google.com/loadAdURL?drt_include=0&request_id=............
W/Ads     ( 1006): JS: The page at https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html displayed insecure content from file:///android_asset/webkit/android-weberror.png.
W/Ads     ( 1006):  (null:1)
W/Ads     ( 1006): Received error HTTP response code: 400
W/Ads     ( 8161): There was a problem getting an ad response. ErrorCode: 0
W/Ads     ( 8161): Failed to load ad: 0

Note: here neither onAdLoaded( ) nor onAdFailedToLoad( ) is getting called

Second device:

I/Ads     ( 1165): CsiReporterFactory: CSI is not enabled. No CSI reporter created.
I/Ads     ( 1165): Starting ad request.
I/Ads     ( 1165): Use AdRequest.Builder.addTestDevice("XXXXXXXXXXXXXXXXXXXXXXXXXX") to get test ads on this device.     
I/Ads     ( 1165): CsiReporterFactory: CSI is not enabled. No CSI reporter created.
W/Ads     ( 1165): There was a problem getting an ad response. ErrorCode: 2
I/Ads     ( 1165): Scheduling ad refresh 60000 milliseconds from now.
W/Ads     ( 1165): Failed to load ad: 2

My code:

protected void onCreate( Bundle icicle )
{
 super.onCreate( icicle );

m_glView = initOpenGLView( ); 

 m_adMobView = new AdView( this );
 m_adMobView.setAdSize( AdSize.SMART_BANNER );
 m_adMobView.setAdUnitId( "XXXXXXXXXXXXXXXXXX" );      <----I just replaced the ID with XXX for this example
 m_adMobView.setAdListener( new AdListener( )
  {
   public void onAdLoaded( ) 
   { 
    egNative.LogMessage( "ADMob::onAdLoaded" );
   };
   public void onAdFailedToLoad( )
   {
    egNative.LogMessage( "ADMob::onAdFailedToLoad" );
   }
  }  );

 FrameLayout layout = new FrameLayout( getApplicationContext( ) );
 layout.addView( m_glView );

 int gravity = android.view.Gravity.CENTER_HORIZONTAL | android.view.Gravity.TOP;
 FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT , 
            FrameLayout.LayoutParams.WRAP_CONTENT ,  gravity );
  layout.addView( m_adMobView , params );
setContentView( layout );
}

@Override protected void onStart( )
 {
  super.onStart( );
  AdRequest.Builder ad_builder = new AdRequest.Builder( );
  m_adMobView.loadAd( ad_builder.build( ) );
 }

I am running the latest version of Google Play services. Also have double checked the Ad unit IDs and they're fine. Not getting any positive results with test Ad unit IDs too. Can you guys post any hints eventually? Thank you in advance.

like image 861
Dan Avatar asked Dec 20 '22 05:12

Dan


2 Answers

I had same issue. It started work for me after I had updated my Billing and Payments details in AdMob Account.

like image 178
Sergey Avatar answered Jan 23 '23 06:01

Sergey


Your package is 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

like image 43
NickUnuchek Avatar answered Jan 23 '23 06:01

NickUnuchek