Software Archive
Read-only legacy content
17060 Discussions

admob if i have 3 html pages i have to call below - all this code - 3 times????

Leonidas_S_
New Contributor I
596 Views

if I put AdMob ADs in my cordova app... Android...  https://github.com/cranberrygame/cordova-plugin-ad-admob

well

if i have 3 html pages i have to call below - all this code - 3 times????  

function onDeviceReady() ..... called in index.html only....? what to do

            function onDeviceReady() {

              // Ad Mob ADs - start

            var bannerAdUnit = "ca-app-pub-000000000000000000";
            var interstitialAdUnit = "ca-app-pub-00000000000000000000";
            var isOverlap = true; //true: overlap, false: split
            var isTest = false;

            window.admob.setUp(bannerAdUnit, interstitialAdUnit, isOverlap, isTest);
            
//            window.admob.onBannerAdShown = function() {
//                alert('onBannerAdShown');
//            };        
            
            window.admob.showBannerAd('bottom-center','SMART_BANNER');

            // Ad Mob ADs - end

                     }

 

0 Kudos
1 Reply
PaulF_IntelCorp
Employee
596 Views

Leonidas, do not use multiple HTML pages if you are using Cordova plugins and Cordova APIs. Limit your app to a single index.html file and use <div> tags that you "hide" and "show" to display multiple "pages." See this Best Practices section of this article for more info: https://cordova.apache.org/docs/en/5.1.1/guide/next/index.html

0 Kudos
Reply