Reputation: 7646
I'm having a problem integrating Admob interstitial ads. My app supports both portrait AND landscape orientation, and as such I have set the manifest to:
android:screenOrientation="fullSensor"
The problem is that the Admob interstitial appears to be fixed/locked to the original orientation of the device on start up. E.g. if I start the app in portrait orientation, and then rotate the device to landscape, then show an ad, then it appears on its side (in portrait orientation)...
How can I force the interstitial to reset to the new device orientation?
I am loading the ad like this:
interstitialAd = new InterstitialAd(activity);
interstitialAd.setAdUnitId(Config.ADMOB_UNIT_ID);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
.build();
interstitialAd.loadAd(adRequest);
and then showing it like this:
interstitialAd.show();
Upvotes: 9
Views: 2445
Reputation: 7646
I fixed this. In the end it came down to re-requesting the ad on orientation change, and importantly, running that request in the UI thread.
Upvotes: 7
Reputation: 5595
Are you looking for SMART_BANNER??
Use it as:
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="XXXXX">
</com.google.android.gms.ads.AdView>
Upvotes: -1
Reputation: 31
Dont know whether this link will be helpful or not... If my answer is irrelevant dnt downvote...Her is the link android admob resize on landscape
Upvotes: 0