当前位置: 首页>>代码示例>>Java>>正文


Java AdSize.SMART_BANNER属性代码示例

本文整理汇总了Java中com.google.ads.AdSize.SMART_BANNER属性的典型用法代码示例。如果您正苦于以下问题:Java AdSize.SMART_BANNER属性的具体用法?Java AdSize.SMART_BANNER怎么用?Java AdSize.SMART_BANNER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.ads.AdSize的用法示例。


在下文中一共展示了AdSize.SMART_BANNER属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: adSizeFromSize

/**
 * Gets an AdSize object from the string size passed in from JavaScript.
 * Returns null if an improper string is provided.
 *
 * @param size The string size representing an ad format constant.
 * @return An AdSize object used to create a banner.
 */
public static AdSize adSizeFromSize(String size) {
  if ("BANNER".equals(size)) {
    return AdSize.BANNER;
  } else if ("IAB_MRECT".equals(size)) {
    return AdSize.IAB_MRECT;
  } else if ("IAB_BANNER".equals(size)) {
    return AdSize.IAB_BANNER;
  } else if ("IAB_LEADERBOARD".equals(size)) {
    return AdSize.IAB_LEADERBOARD;
  } else if ("SMART_BANNER".equals(size)) {
    return AdSize.SMART_BANNER;
  } else {
    return null;
  }
}
 
开发者ID:psydrake,项目名称:litecoinEasyCheck,代码行数:22,代码来源:AdMob.java

示例2: adSizeFromSize

/**
 * Gets an AdSize object from the string size passed in from JavaScript.
 * Returns null if an improper string is provided.
 * 
 * @param size
 *            The string size representing an ad format constant.
 * @return An AdSize object used to create a banner.
 */
public static AdSize adSizeFromSize(String size) {
	if ("BANNER".equals(size)) {
		return AdSize.BANNER;
	} else if ("IAB_MRECT".equals(size)) {
		return AdSize.IAB_MRECT;
	} else if ("IAB_BANNER".equals(size)) {
		return AdSize.IAB_BANNER;
	} else if ("IAB_LEADERBOARD".equals(size)) {
		return AdSize.IAB_LEADERBOARD;
	} else if ("SMART_BANNER".equals(size)) {
		return AdSize.SMART_BANNER;
	} else {
		return null;
	}
}
 
开发者ID:rafinskipg,项目名称:BombTouch,代码行数:23,代码来源:AdMobPlugin.java

示例3: onCreateView

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    RelativeLayout v = (RelativeLayout) super.onCreateView(inflater, container, savedInstanceState);

    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mHideAds, new IntentFilter(ConstsFree.REMOVE_ADS));
    /**
     * If ads are disabled we don't need to load any
     */
    if (!SharedPreferencesHelperFree.getDisableAds(getActivity())) {
        mAdView = new AdView(getActivity(), AdSize.SMART_BANNER, ConstsFree.ADMOB_ID);

        /**
         * The AdView should be attached to the bottom of the screen, with the GridView position above it
         */
        RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                                                                               ViewGroup.LayoutParams.WRAP_CONTENT);
        adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        v.addView(mAdView, adParams);

        mAdView.loadAd(AdUtil.getAdRequest());
    }

    return v;
}
 
开发者ID:antew,项目名称:RedditInPictures,代码行数:24,代码来源:RedditImageListFragmentFree.java

示例4: InitializeUIThread

public void InitializeUIThread(String p_key) {
	
	// Create the interstitial
	interstitial = new InterstitialAd(activity, p_key);
	
	// Create banner
	adView = new AdView(activity, AdSize.SMART_BANNER, p_key);

	RelativeLayout layout = ((Godot)activity).layout;
	RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
        LayoutParams.WRAP_CONTENT);

	layoutParams.addRule(layoutRule1);
	layoutParams.addRule(layoutRule2);
	layout.addView(adView, layoutParams);
	layout.invalidate();

	adView.setVisibility(View.VISIBLE);        
	
	initialized = true;
	
    	adReceived = false;
    	screenDismissed = false;
    	failedToReceiveAd = false;
    	applicationLeaved = false;
    	presentScreen = false;        

	Log.d("godot", "AdMob: Initialized");
}
 
开发者ID:punto-,项目名称:godot_modules,代码行数:29,代码来源:GodotAdMob.java

示例5: onCreate

@SuppressWarnings("deprecation")
@Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       MainActivity.app = this;
       
       // Create the layout
       RelativeLayout layout = new RelativeLayout(this);

       // Do the stuff that initialize() would do for you
       requestWindowFeature(Window.FEATURE_NO_TITLE);
       getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
               WindowManager.LayoutParams.FLAG_FULLSCREEN);
       getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

       // Create the libgdx View
       AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
       View gameView = initializeForView(new Game(new AndroidServices()), cfg);


       // Create and setup the AdMob view
       AdView adView = new AdView(this, AdSize.SMART_BANNER, "ca-app-pub-3144450577280402/6068522170"); // Put in your secret key here
       adView.loadAd(new AdRequest());
       
       // Add the libgdx view
       layout.addView(gameView);

       // Add the revmob view
       RelativeLayout.LayoutParams adParams = 
               new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, 
                       RelativeLayout.LayoutParams.WRAP_CONTENT);
       
       adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
       adParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
       
       layout.addView(adView, adParams);

       // Hook it all up
       setContentView(layout);
       
   }
 
开发者ID:pierotofy,项目名称:snappyfrog,代码行数:41,代码来源:MainActivity.java

示例6: onCreateView

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    RelativeLayout v = (RelativeLayout) super.onCreateView(inflater, container, savedInstanceState);
    mGridView = (GridView) v.findViewById(R.id.gridView);

    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mHideAds , new IntentFilter(ConstsFree.REMOVE_ADS));
    /**
     * If ads are disabled we don't need to load any
     */
    if (!SharedPreferencesHelperFree.getDisableAds(getActivity())) {
        mAdView = new AdView(getActivity(), AdSize.SMART_BANNER, ConstsFree.ADMOB_ID);

        /**
         * The AdView should be attached to the bottom of the screen, with the GridView position above it
         */
        RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        v.addView(mAdView, adParams);

        /**
         * We use the onGlobalLayoutListener here in order to adjust the bottom margin of the GridView
         * so that when the user scrolls to the bottom of the GridView the last images are not obscured
         * by the AdView
         */
        mAdView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

            @Override
            public void onGlobalLayout() {
                if (mAdView != null && mGridView != null) {
                    int height = mAdView.getHeight();
                    if (height > 0) {
                        RelativeLayout.LayoutParams gridViewParams = (RelativeLayout.LayoutParams) mGridView.getLayoutParams();
                        gridViewParams.setMargins(0, 0, 0, height);
                        mGridView.setLayoutParams(gridViewParams);
                        mAdView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                    }
                }
            }
        });
        mAdView.loadAd(AdUtil.getAdRequest());
    }

    return v;
}
 
开发者ID:antew,项目名称:RedditInPictures,代码行数:45,代码来源:RedditImageGridFragmentFree.java

示例7: requestAd

/**
 * Interface called by the AN SDK to request an ad from the mediating SDK.
 *
 * @param mBC       the object which will be called with events from the 3d party SDK
 * @param activity  the activity from which this is launched
 * @param parameter String parameter received from the server for instantiation of this object
 * @param adUnitID  The 3rd party placement , in DFP this is the adUnitID
 * @param width     Width of the ad
 * @param height    Height of the ad
 */
@Override
public View requestAd(MediatedBannerAdViewController mBC, Activity activity, String parameter, String adUnitID,
                      int width, int height, TargetingParameters targetingParameters) {
    adListener = new AdMobAdListener(mBC, super.getClass().getSimpleName());
    adListener.printToClog(String.format("requesting an ad: [%s, %s, %dx%d]", parameter, adUnitID, width, height));

    DFBBannerSSParameters ssparm = new DFBBannerSSParameters(parameter);
    AdSize adSize = ssparm.isSmartBanner ? AdSize.SMART_BANNER : new AdSize(width, height);

    if (ssparm.isSwipeable) {
        dfpView = new SwipeableDfpAdView(activity, adSize, adUnitID);
    } else {
        dfpView = new DfpAdView(activity, adSize, adUnitID);
    }

    dfpView.setAdListener(adListener);
    AdRequest ar = new AdRequest();

    if (ssparm.test_device != null && ssparm.test_device.length() > 0) {
        adListener.printToClog("requestAd called with test device " + ssparm.test_device);
        ar.addTestDevice(ssparm.test_device);
    }

    switch (targetingParameters.getGender()) {
        case UNKNOWN:
            break;
        case FEMALE:
            ar.setGender(AdRequest.Gender.FEMALE);
            break;
        case MALE:
            ar.setGender(AdRequest.Gender.MALE);
            break;
    }
    DfpExtras extras = new DfpExtras();
    if (targetingParameters.getAge() != null) {
        extras.addExtra("Age", targetingParameters.getAge());
    }
    if (targetingParameters.getLocation() != null) {
        ar.setLocation(targetingParameters.getLocation());
    }
    for (Pair<String, String> p : targetingParameters.getCustomKeywords()) {
        extras.addExtra(p.first, p.second);
    }
    ar.setNetworkExtras(extras);

    dfpView.loadAd(ar);

    return dfpView;
}
 
开发者ID:appnexus,项目名称:mobile-sdk-android,代码行数:59,代码来源:LegacyDFPBanner.java


注:本文中的com.google.ads.AdSize.SMART_BANNER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。