How do I Test and Implement Admob for Android (w Cordova)?

  • Hello again! I'm trying to test ads with Admob, but nothing happens both when I preview in browser and when I tested a debug apk on my phone. I believe I have the proper interstitial ID set (however, am I supposed to put the App ID somewhere? I just pasted it into the banner ID since I don't use any banner ads). By the way, there is a third option on Admob for rewards that I wanted to use, but I don't see an ID slot for it in the CS2 plugin.

    I want to let the player earn a life by watching an ad. I have the event set so that when the life icon sprite is tapped, to preload interstitial ad. Then on interstitial received, to show it. But when I run my game, it doesn't do anything. Any thoughts? Thanks in advance!

  • Hello again! I'm trying to test ads with Admob, but nothing happens both when I preview in browser and when I tested a debug apk on my phone. I believe I have the proper interstitial ID set (however, am I supposed to put the App ID somewhere? I just pasted it into the banner ID since I don't use any banner ads). By the way, there is a third option on Admob for rewards that I wanted to use, but I don't see an ID slot for it in the CS2 plugin.

    I want to let the player earn a life by watching an ad. I have the event set so that when the life icon sprite is tapped, to preload interstitial ad. Then on interstitial received, to show it. But when I run my game, it doesn't do anything. Any thoughts? Thanks in advance!

    AdMob ads only can appear on native mobile platform, if you want to try I have video tutorial for "AdMob Rewarded Video Ads" https://youtu.be/xHjw3McA4z4

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • > Hello again! I'm trying to test ads with Admob, but nothing happens both when I preview in browser and when I tested a debug apk on my phone. I believe I have the proper interstitial ID set (however, am I supposed to put the App ID somewhere? I just pasted it into the banner ID since I don't use any banner ads). By the way, there is a third option on Admob for rewards that I wanted to use, but I don't see an ID slot for it in the CS2 plugin.

    >

    > I want to let the player earn a life by watching an ad. I have the event set so that when the life icon sprite is tapped, to preload interstitial ad. Then on interstitial received, to show it. But when I run my game, it doesn't do anything. Any thoughts? Thanks in advance!

    AdMob ads only can appear on native mobile platform, if you want to try I have video tutorial for "AdMob Rewarded Video Ads" https://youtu.be/xHjw3McA4z4

    Hello! I have used your method, and after I though I had it all worked out, I ran into problems.

    My first issue was that after I triggered the ad, the ad would continue to loop over and over again. Even if I tried to cancel the reward, another ad would just pop up right away.

    So I realized a couple of things I did wrong, I called the function with parameter load within the show parameter, but after changing that and re exporting and everything, my problem got even worse! Now as soon as I launch the app, I'm met with a black screen briefly before I was spammed again with ads. Any ideas?

  • Got a little further by changing auto show to false, but now my main menu won't load, I'm left with a black screen

  • Got a little further by changing auto show to false, but now my main menu won't load, I'm left with a black screen

    Can you post the screenshot from your event sheet?

    Inside JS you can found:

     admob.rewardvideo.config({
     //Rewarded Video Config
     forChild: null, // Set banner ad for Child-directed value null or true
     forFamily: null, // Set banner ad for Family-directed value null or true
     isTesting: true, // Set true if under development and false for publication
     autoShow: false, // auto show or hide video ad, false will hide the video ads after video ad loaded true will show video ad after video ad loaded.
     })
     admob.rewardvideo.prepare() //Delete this line or mark as comment if you don't want to use video rewarded ad
     
    }, false)
    document.addEventListener('admob.rewardvideo.events.REWARD', function(event) {
     // console.log(event)
     c2_callFunction("Log", ["Rewarded Video Finished - Give User Reward"]);
     c2_callFunction("GiveReward", ["true"]);
     //load new rewarded video on background
     admob.rewardvideo.prepare()
    })

    You no need to load the reward video on the start layout, this will automatically load the reward video for the first time when your game start also after user close the rewarded video.

    If you want to manually load the reward video then mark as comment or delete:

    admob.rewardvideo.prepare()

    then call exec js manually inside C2 via browser exec js:

    admob.rewardvideo.prepare();
  • You no need to load the reward video on the start layout, this will automatically load the reward video for the first time when your game start also after user close the rewarded video.

    If you want to manually load the reward video then mark as comment or delete:

    > admob.rewardvideo.prepare()

    then call exec js manually inside C2 via browser exec js:

    > admob.rewardvideo.prepare();

    I had turned auto show on to see if that was the reason my ads weren't showing, so that might have been causing the loop. But when I had disabled it again, I was getting that black screen problem. Here's the codee I'm using.

  • Try this:

    Don't forget to included the admob.rewarded.js file on your index.html and you no need to call function load ads in Construct 2 because inside admob.rewarded.js already preload ads automatically.

  • Don't forget to included the admob.rewarded.js file on your index.html and you no need to call function load ads in Construct 2 because inside admob.rewarded.js already preload ads automatically.

    So close now, thank you for the help so far! I've got it working so that the ad only plays once and then gives the reward. However, I've built and signed the apk (turned istesting false), pushed the update to google play, but the only ad that displays is the test ad. I'm assuming I've skipped a step somewhere, but I can't figure out what.

  • You're welcome.

    May I ask which one following below you use the ads js:

    admob.banner.interstitial.js

    admob.banner.interstitial.rewarded.js

    admob.rewarded.js

    Example if you use admob.rewarded.js then you should put that javascript on your index.html

    Please see example below:

    Also don't forget to change the ads id inside ads javascript.

    If ad only plays once and then gives the rewards, maybe there something wrong on your event sheet.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)