Banner advertisements which display at the bottom of the app screen.
jump to: banner | removeBanner | Example
adMob.banner(banner_id,adMob.ad_sizes.RESIZE,adMob.ad_positions.BOTTOM).then(function () {
// do anything after banner has loaded successfully
}).catch (function(err){
// view or handle error messages
});- show a banner ad at the top or bottom of the app screen
- by default the ad size is "banner", 320x50, and the ad position is at the bottom of the screen
- use after the start up of the device (
onDeviceReady)
Google AdMob id- for a banner ad
can be"test"for test ads, or normally an ad string ("ca-app-pub-4029587076166791/6431168058"), or an ad_id object:
var admob_ids = {
'android' : {
'banner': "ca-app-pub-4029587076166791/6431168058",
'interstitial': "ca-app-pub-4029587076166791/1370413062",
'rewarded': "ca-app-pub-4029587076166791/9712771663",
'rewardedInterstitial': "ca-app-pub-4029587076166791/3530506691"
}, 'ios' : {
'banner': "ca-app-pub-4029587076166791/6694891931",
'interstitial': "ca-app-pub-4029587076166791/2436352227",
'rewarded': "ca-app-pub-4029587076166791/5286441495",
'rewardedInterstitial': "ca-app-pub-4029587076166791/2300620853"
}
};
ad_size(optional - select a banner size, default is BANNER)`
adMob.ad_sizes.RESIZEresizes to the get the largest fitting available banneradMob.ad_sizes.BANNERdefault 320x50 ad banneradMob.ad_sizes.LARGE_BANNER300x100adMob.ad_sizes.MEDIUM_RECTANGLE300x250adMob.ad_sizes.FULL_BANNER468x60adMob.ad_sizes.LEADERBOARD728x90
ad_position(optional - select a banner position, default is BOTTOM)`
adMob.ad_positions.BOTTOMdefaultadMob.ad_positions.TOP
- error["description"] //short description about where the error is coming from
- error["name"] //name of the error (LOAD_AD_ERROR, SHOW_AD_ERROR, INVALID_ARGUMENTS, etc.)
- error["message"] //error message, more information about the error
- error["responseCode"] //ad error response code from Google (if there is one)
- error["responseMessage"] //ad error response message from Google (if there is one)
common error names:
LOAD_AD_ERRORmay occur when an ad id is not reconized or not ready to show ads yet
- call this again if it fails
- banners overlap the main view, except for the top banner in Android
adMob.removeBanner().then(function () {
// do anything after banners were removed
}).catch (function(err){
// view or handle error messages (uncommon)
});- remove the banner ad
- use after a call to banner if you wish to remove it
- none needed
function onDeviceReady() {
adMob.banner(banner_id,adMob.ad_sizes.RESIZE).catch(function(err){});
}
