I am trying to get AdMob ads to display in my android application and have been unable to do so. I have contacted their support and have not received any response in almost
Admob should have included this as a warning, but I digress...
In your layout you have android:padding="5dip"
this of course causes phones like the G1 to 'lose' some of their available screen real-estate (below 320dip width). Which is of course the minimum width for an admob ad, causing it to fail. Then calling onFailedToReceiveAd
in the listener with no explanation whatsoever.
The logs only contain
WARN/AdMobSDK(347): Ignoring requestFreshAd() because we are requesting an ad right now already.
The fix is simple, don't use padding or margins in the root of your layouts that contain ads. Took some experimentation, but it works.
Try getting rid of
if ( ad != null ) {
ad.setVisibility ( View.VISIBLE );
ad.setAdListener ( new AdListener () );
}
and seeing if it works, as mine is identical without those lines and works fine.
Ryan have you set your Admob publisher Id???
<meta-data android:value="YOUR_ADMOB_PUBLISHER_ID"
android:name="ADMOB_PUBLISHER_ID" />
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent" android:id="@+id/rltvLayout1"
android:layout_height="fill_parent">
<LinearLayout android:id="@+id/linearLayoutwebview"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:orientation="vertical">
<WebView android:id="@+id/webView"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:fitsSystemWindows="true" />
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/ad_layout" android:layout_height="wrap_content"
android:gravity="bottom" android:layout_alignParentBottom="true"
android:layout_alignBottom="@+id/home_layout">
<com.google.ads.AdView android:layout_width="wrap_content"
android:layout_height="wrap_content" ads:adUnitId="put here your id"
ads:adSize="BANNER" android:id="@+id/adView" ads:refreshInterval="60" />
</LinearLayout>
</RelativeLayout>