AdMob SMART_BANNER problems



I have a SMART_BANNER at the bottom of my app.


The SMART_BANNER is declared in Layout XML in this way:



<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
xmlns:app="http://ift.tt/GEGVYd"
android:id="@+id/mainLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".MainActivity" >

<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<com.google.android.gms.ads.AdView
xmlns:ads="http://ift.tt/GEGVYd"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:adSize="SMART_BANNER"
app:adUnitId="ca-app-pub-xxxxxxxxx" /> </RelativeLayout>


My AndroidManifest has this:



<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />


and the ads is initialized in onCreate in this way:



if (Build.VERSION.SDK_INT > Build.VERSION_CODES.FROYO) {

AdView adView = (AdView)this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("TEST_DEVICE_ID")
.build();
adView.loadAd(adRequest);

}


When the app starts in portrait mode, the ads is shown; when I put the phone in landscape mode, the ads is scaled and doesn't fill all the available space... The ads is shown even when the app starts in landscape mode but, when I put the phone in portrait mode, LogCat shows:



Not enough space to show ad!


Why? How can I fix these problems?


Sorry for my bad english, Thanks in advance!


No comments:

Post a Comment