Ionic - Cordova AdMob

The Cordova AdMob module is employed for group action advertisements locally. we'll utilize the admobpro module during this section, since the admob is deprecated.

Using AdMob

To be able to use advertisements in your application, you wish to sign on to admob and make a flag. once you try this, you may get associate degree Ad Publisher ID. Since these means aren't a locality of the Ionic structure, we'll not make a case for it here. you'll be capable to pursue the means by Google bolster group here.

You also will ought to have mechanical man or iOS stage put in, since the cordova modules work solely on local stages. we've as of now mentioned the way to try this in our surroundings setup chapter.

The AdMob module will be put in within the prompt window.

C:\Users\Username\Desktop\MyApp> cordova module include cordova-module admobpro

Now that we've put in the module, we want to visualize if the gadget is prepared before we tend to ar able to use it. this is often why we want to feature the subsequent code within the $ionicPlatform.ready operate within the app.js.

A similar code will be connected for iOS or a Windows Phone. you may solely use a special id for these stages. rather than a pennant, you'll be capable to use opening promotions that may cowl whole screen.

AdMob Methods

Method Parameters Details
createBanner(parameter1, parameter2, parameter3) adId/options, success, fail Used for creating the banner.
removeBanner() / Used for evacuating the banner.
showBanner(parameter1) position Used for demonstrating the banner.
showBannerAtXY(parameter1, parameter2) x, y Used for appearing standard at indicated location.
hideBanner(); / Used for concealing the banner.
prepareInterstitial(parameter1, parameter2, parameter3) adId/choices, achievement, fail Used for getting ready interstitial.
showInterstitial(); / Used for appearing/td>
setOptions(parameter1, parameter2, parameter3) options, achievement, fail Used for setting the default an incentive for other methods.
The accompanying table demonstrates the occasions that can be utilized with admob.
Event Details
onAdLoaded Called when the advertisement is loaded.
onAdFailLoad Called when the advertisement is neglected to load.
onAdPresent Called when the promotion will be appeared on screen.
onAdDismiss Called when the promotion is dismissed.
onAdLeaveApp Called when the client leaves the application by tapping the ad.

You can deal with these occasions by following the model below.

document.addEventListener('onAdLoaded', function(e){ 

//Handle the event... 


Welookups is optimized for learning.© 2018 kumar aditya singh .
All Right Reserved and you agree to have read and accepted our term and condition.
All Rights Reserved.