1.3 Methods for Banner

floatinghotpot edited this page Sep 15, 2014 · 1 revision

AdMob.createBanner(adId/options, success, fail)

Purpose: create a banner Ad.

Param

  • adId, string, the Ad unit Id for banner.
  • options, json object, see the keys in AdMob.setOptions
  • success, function, callback when success, can be null or missing.
  • fail, function, callback when fail, can be null or missing.

Extra key/value for param options

  • adId, string, Ad unit Id for this banner.
  • success, function, callback when success.
  • error, function, call back when fail.

Example Code:

AdMob.createBanner( admobid.banner );

AdMob.createBanner({
	adId: admobid.banner,
	position: AdMob.AD_POSITION.BOTTOM_CENTER,
	autoShow: true,
	success: function(){
	},
	error: function(){
		alert('failed to create banner');
	}
});

AdMob.showBanner(position)

Purpose: show banner at given position. It can also be used to move banner to given position. It's not needed to removeBannr and create a new one.

Params:

  • position, integer, see description in AdMob.setOptions()

AdMob.showBannerAtXY(x, y)

Purpose: show banner at given position with (x,y).

Params:

  • x, integer, in pixels. Offset from screen left.
  • y, integer, in pixels. Offset from screen top.

AdMob.hideBanner()

Purpose: hide the banner, remove it from screen, but can show it later.

AdMob.removeBanner()

Purpose: destroy the banner, remove it from screen.

You can create another banner if different size, need remove the old one.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.