Bruno58

Admob phonegap

Recommended Posts

I NEEED HELP PLEASE..

I just finished a phaser game and Im trying to implement admob to my app. Its been so hard nothing work idk what to do anymore, ive seen all the tutorials that ive found I seen this all of them https://github.com/floatinghotpot/cordova-admob-pro

I still cant get them to work please help help help.

I'll attach my html

please someone help me step by step i need to monetize my apps.

thank you

index.html

Share this post


Link to post
Share on other sites

Tnx for replying!

No I build it completely and build it to build.phonegap.com and download the apk then test on a device and no luck.. 

now I've tried code samples like this one

floatinghotspot/admob-demo-game-phaser I downloaded it and build it like I do to mine and it shows ads!! But it doesn't work w mine and I've copied all his sections to admob to mine to see if that works but simply no luck...  

Share this post


Link to post
Share on other sites

Hows that? the error handler Sry explain im trying to find errors all I get is this.

Uncaught ReferenceError: AdMob is not defined
    at initApp (admob.js:26)
    at admob.js:22
initApp @ admob.js:26
(anonymous) @ admob.js:22


and my admob file is as follows-------------------------------------------------------------------------------------------------

(function(document)
 {
  "use strict";
     function ad_failure(message)
     {
         /* insert your own ad failure code here */
         //console.log(message);
     }

     function prepareAds()
     {
         if( window.plugins && window.plugins.AdMob )
         {
            var ad_nodelist = document.querySelectorAll("template.admob");
            var ad_array = Array.prototype.slice.call(ad_nodelist);
            ad_array.forEach(function(domNode)
            {
                var admob_ios_key       = domNode.attributes["data-ios-key"].value;
                var admob_android_key   = domNode.attributes["data-android-key"].value;
                var banner_at_top       = (domNode.attributes["data-top"].value === "true");
                var adId = (navigator.userAgent.indexOf('Android') >=0) ? admob_android_key : admob_ios_key;
                var am = window.plugins.AdMob;

                am.setOptions( {
                    publisherId: adId,
                    bannerAtTop: banner_at_top, // set to true, to put banner at top
                    overlap: false, // set to true, to allow banner overlap webview
                    offsetTopBar: true, // set to true to avoid ios7 status bar overlap
                    isTesting: true // receiving test ad
                });
                am.createBannerView();
            });//each
        }
     }

     document.addEventListener("app.Ready",prepareAds,false);
 })(document);

 

Share this post


Link to post
Share on other sites

this is how i have my html--------------------------------------------------------------------------------------

 

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf8">
  <meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="viewport" content="user-scalable=no, initial-scale=1.0, width=device-width, height=device-height">
    
  <script src="cordova.js"></script>
    <script src="js/admob.js"></script>
  <script src="js/phaser.js"></script>
    <script src="js/stateTitle.js"></script>
  <script src="js/main.js"></script>
  <script src="js/stateOver.js"></script>
    <script src="js/characters.js"></script>
    <script src="js/side.js"></script>
  <script src="lib/jquery-2.0.3.min.js"></script>

    <style>
    
    html, body {
      min-height: 100%;
    }

    body {
      margin: 0px;
      padding: 0px;
      position: relative;
    }

 


    </style>


</head>

<body>
    

</body>

 

</html>

Share this post


Link to post
Share on other sites

Are you  compiling for Android?  I had a hell of a time this week using a cordova plugin and it turned out that the latest Android SDK broke cordova support.  I had to overwrite the tools folder in the v25 SDK with the tools folder from v24 of the SDK to get it to work.

Share this post


Link to post
Share on other sites

DUD.... it was that!!! I used an old version of admob manually doing everything and the ads worked I did more than 20something hours strait trying to fix this I can believe it was just that! tnk uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.