2dar
2dar

Reputation: 651

Cordova and AdMob

I am using AdMob with cordova for displaying banners.

My Question is necessary to remove banner in pause ( when user left the app ) and in resume ( user oppen again the app ) display the banner again ?

Upvotes: 0

Views: 232

Answers (2)

David
David

Reputation: 2761

To hide the banner is not necessary if you're leaving the app (however it is recommended to release resources).

Take in mind it is necessary to stop interstitial requests if you are in autoShowInterstitial mode, as otherwise interstitials could be shown when your android app is in background (normally this is not happening in ios due to sandbox)

You can see a complete example on how to use onPause and onResume to hide/show interstitials here: https://github.com/appfeel/admob-google-cordova/wiki/showInterstitialAd

You'll see that there are the methods to remove banner view, this in order to release resources. That may prevent your app from being killed when memory request occurs.

Upvotes: 0

Zappescu
Zappescu

Reputation: 1439

If you're asking for a method that could hide the banner when in pause and show the banner when in resume (if I got the question), you can use the following Cordova functions:

jQuery(document).ready(function($) {    
    $(document).on('deviceready', function() {
        /* Manage events */
        $(document).on('pause',                 function() {    /*Call function to hide banner*/                });
        $(document).on('resume',                function() {    /*Call function to show banner*/                });
    }
}

Upvotes: 1

Related Questions