VincentLamoute
VincentLamoute

Reputation: 810

DoubleClick - Interstitial advertise sizing/cropping/center placing -> Impossible?

Following this code (https://developers.google.com/mobile-ads-sdk/docs/admob/advanced):

import com.google.ads.*;

public class BannerExample extends Activity implements AdListener {

  private InterstitialAd interstitial;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // Create the interstitial
    interstitial = new InterstitialAd(this, MY_INTERSTITIAL_UNIT_ID);

    // Create ad request
    AdRequest adRequest = new AdRequest();

    // Begin loading your interstitial
    interstitial.loadAd(adRequest);

    // Set Ad Listener to use the callbacks below
    interstitial.setAdListener(this);
  }

  @Override
  public void onReceiveAd(Ad ad) {
    Log.d("OK", "Received ad");
    if (ad == interstitial) {
      interstitial.show();
    }
  }
}

I have an image (my advertise) smaller than my phone screen. I want to know if it's possible to resize the view created into the java code. (in onCreate() or onReceiveAd()) for adapting the size of the advertise.

LayoutParam, in CenterCrop for exemple, or simple resizing of the view !

Upvotes: 3

Views: 1377

Answers (1)

Eric Leichtenschlag
Eric Leichtenschlag

Reputation: 8931

If you want to serve an interstitial from DFP to a phone, you can set up an image in DFP, and override the size to be 320x480. Then that creative can serve, and be smaller if you want.

Or, you may be looking for a banner instead of an interstitial overlay that takes over the entire screen. In that case, you can specify a custom size for your AdView, that should match the size you set up in DFP.

Upvotes: 2

Related Questions