0

I am developing an app of which all environment are in landscape.

Manifest.xml

    <activity 
        android:name=".Main"
        android:screenOrientation="landscape"/>

Main.java

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);   

Screenshots:

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:

Improerly Rendered Image

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:

Properly Rendered Image

Question:

  1. I believe interstitialAd could support landscape? But how could that be modified?

  2. If the interstitialAd cannot be modified, how can I force the system to set SCREEN AUTO_ROTATABLE to indirectly solve the problem?

Kate Gregory
  • 18,808
  • 8
  • 56
  • 85
pearmak
  • 4,979
  • 15
  • 64
  • 122

1 Answers1

0

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 (e.g. 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.

botteaap
  • 5,790
  • 3
  • 29
  • 35