Admob indegration not show the ads


#1

i put this

     <script type="text/javascript" src="cordova.js"></script>
> <script type="text/javascript">
> 	document.addEventListener("deviceready", function() {
> 	    setTimeout(function() {
> 	        navigator.splashscreen.hide();
> 	    }, 5000, false);
> 	});
> </script>

// Banner code
var service = Cocoon.Ad;

//multiplatform default configuration
service.configure({
android: {
banner:“ca-app-pub-3940256099942544/6300978111”}
});

var banner = Cocoon.Ad.AdMob.createBanner("ca-app-pub-3940256099942544/6300978111");
banner.load();
//Automatic banner layout
banner.setLayout(Cocoon.Ad.BannerLayout.TOP_CENTER);
banner.show();

and this but not show the banner

the core is html and javascript without any framework js

What about cordova.js
should i download the file or it will be automatically added by the plugin

i dont put this in head
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />

becouse change my layout


#2

There is a tutorial on this site .Read & follow ,it should work fine.
Make sure your admob unit is working.
New unit may take 24 hours or more to start to serve ads.


#3

This is the error from chrome console
Cocoon is not defined
at createBanner (test.js:18)
at test.js:65
var bannerStatus;
var interstitialStatus;

var banner;
var interstitial;
var demoPosition;

var backgroundTexture;
var button1Texture;
var button2Texture;

var adService;

var container;

function createBanner() {
// Global configuration
Cocoon.Ads.configure({
banner:“ca-app-pub-7686972479101507/8873903476”
});

adService.configure({
ios: {
banner:“ca-app-pub-7686972479101507/8873903476”,
interstitial:“ca-app-pub-7686972479101507/8873903476”,
},
android: {
banner:“ca-app-pub-3940256099942544/6300978111”
}
});

      adService = Cocoon.Ad.AdMob;


      banner.on("load", function(){
         console.log("Banner loaded " + banner.width, banner.height);
         banner.show();
      });

      banner.on("fail", function(){
         console.log("Banner failed to load");
      });

      banner.on("show", function(){
         console.log("Banner shown a modal content");
      });

      banner.on("dismiss", function(){
         console.log("Banner dismissed the modal content");
      });

      banner.on("click", function(){
         console.log("Banner clicked");
      });

//test
var banner = Cocoon.Ad.createBanner();
banner.load();
banner.show();
banner.setPosition(100, 100);
Cocoon.Ad.releaseBanner(banner);
}

createBanner();


#4

Can anybody help
How to integrate admob ads in simple Html
The demo turorial in full with function
And why the console error is Cocoon is not defined


#5

Have you also added the AdMob Cordova plugins to your projects?
Otherwise it won’t work.


#6

i test in on html /javascript file, no another framework
i added cocon admob plugin from tutorial
but something in my code is not OK :slight_smile:
i paste my code above


#7

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.