I am developing an app of which all environment are in landscape.
<activity
android:name=".Main"
android:screenOrientation="landscape"/>
public class Startup extends Activity implements AdListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
interstitialAd = new InterstitialAd(this, MY_PUBLISHER_ID); // Create an ad.
interstitialAd.setAdListener(this); // Set the AdListener.
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
interstitialAd.loadAd(adRequest);
The Ad loads, but does not appear properly; there is a lot of white blank space at the bottom of the screen (under the ad), and it seems the ad is in portrait mode but chopped as shown below:
However, I discovered that if I GO OUTSIDE the app and set the system screen to be able to SCREEN AUTO_ROTATABLE
, then the ad can be displays properly like below:
I believe interstitialAd
could support landscape? But how could that be modified?
If the interstitialAd
cannot be modified, how can I force the system to set SCREEN AUTO_ROTATABLE
to indirectly solve the problem?
It sounds like this should be configured on the server side as mentioned here: https://developers.google.com/mobile-ads-sdk/docs/dfp/advanced
There is no need to define a separate ad unit for landscape mode. You can simply add the landscape size (eg 480x320 for smartphones) to line items targeting the interstitial ad unit and include a creative with the landscape size in addition to the regular portrait size.
I don't have access to DoubleClick for Publishers so I can't verify if that would work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.