Java 类com.facebook.ads.AdSize 实例源码

项目:kognitivo    文件:BannerFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Initialize status label
    statusLabel = getString(R.string.loading_status);

    // Create a banner's ad view with a unique placement ID (generate your own on the Facebook app settings).
    // Use different ID for each ad placement in your app.
    boolean isTablet = getResources().getBoolean(R.bool.is_tablet);
    adViewBanner = new AdView(this.getActivity(), "YOUR_PLACEMENT_ID",
            isTablet ? AdSize.BANNER_HEIGHT_90 : AdSize.BANNER_HEIGHT_50);

    // Set a listener to get notified on changes or when the user interact with the ad.
    adViewBanner.setAdListener(this);

    // Initiate a request to load an ad.
    adViewBanner.loadAd();
}
项目:mobile-sdk-android    文件:FacebookBanner.java   
@Override
public View requestAd(MediatedBannerAdViewController mBC, Activity activity, String parameter, String uid, int width, int height, TargetingParameters tp) {
    FacebookListener fbListener = new FacebookListener(mBC, this.getClass().getSimpleName());
    AdSize adSize;
    if (width == 320 && height == 50) {
        adSize = AdSize.BANNER_320_50;
    } else if (height == 50) {
        adSize = AdSize.BANNER_HEIGHT_50;
    } else if (height == 90) {
        adSize = AdSize.BANNER_HEIGHT_90;
    } else if (height == 250) {
        adSize = AdSize.RECTANGLE_HEIGHT_250;
    } else {
        Clog.e(Clog.mediationLogTag, "Facebook - Attempted to instantiate with size other than the allowed size of 320x50, -1x50, -1x90, -1x250");
        mBC.onAdFailed(ResultCode.UNABLE_TO_FILL);
        return null;
    }
    adView = new AdView(activity, uid, adSize);
    adView.setAdListener(fbListener);
    adView.loadAd();
    return adView;
}
项目:kognitivo    文件:RectangleFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Initialize status label
    statusLabel = getString(R.string.loading_status);

    adViewRectangle = new AdView(this.getActivity(), "YOUR_PLACEMENT_ID", AdSize.RECTANGLE_HEIGHT_250);

    // Set a listener to get notified on changes or when the user interact with the ad.
    adViewRectangle.setAdListener(this);

    // Initiate a request to load an ad.
    adViewRectangle.loadAd();
}
项目:react-native-fbads    文件:BannerViewManager.java   
@ReactProp(name = "size")
public void setSize(BannerView view, int size) {
  AdSize adSize = null;
  switch (size) {
    case 90:
      adSize = AdSize.BANNER_HEIGHT_90;
      break;
    case 250:
      adSize = AdSize.RECTANGLE_HEIGHT_250;
    case 50:
    default:
      adSize = AdSize.BANNER_HEIGHT_50;
  }
  view.setSize(adSize);
}
项目:react-native-fbads    文件:BannerView.java   
public void setSize(AdSize size) {
  mSize = size;
  createAdViewIfCan();
}