Need help for rewarded video on creator

Need help for rewarded video on creator
0

#1

So, i have configured project/build/jsb-default/res/sdkbox_config with the test ads ID given by google here(i’m testing on android device) :https://developers.google.com/admob/android/test-ads
here is part of the sdkbox_config

“gameover”: {
“type”: “interstitial”,
“id”: “ca-app-pub-3940256099942544/1033173712”
},
“home”: {
“width”: 300,
“type”: “banner”,
“id”: “ca-app-pub-1329374026572143/2685130917”,
“alignment”: “bottom”,
“height”: 100
},
“rewarded”: {
“type”: “rewarded_video”,
“id”: “ca-app-pub-3940256099942544/5224354917”
},

and here is my admob JS functions

cacheInterstitial: function() {
if(cc.sys.isMobile) {
sdkbox.PluginAdMob.cache(‘gameover’);
}
},

cacheRewarded: function(){
    if(cc.sys.isMobile) {
        sdkbox.PluginAdMob.cache('rewarded');
    }
},

showRewarded: function() {
    if(cc.sys.isMobile) {
        sdkbox.PluginAdMob.show('rewarded');
    }
},

showInterstitial: function() {
    if(cc.sys.isMobile) {
        sdkbox.PluginAdMob.show('gameover');
    }
},

The thing is that although the interstials ads works perfeclty, when i click my linked button watch the rewarded one, nothing happen, i tried to with a cache button, cache on start (and i played the game for a while to make it load), but when i want to see the video nothing happen anyway, i’ve checked on my phone if the app was taking more storage after the cache was enabled (on start or by a button), but the amount of storage taken by the app varies by some Ko only.


How do i solve this compilation issue? (sdkBox, minsdk,...)
#2

@yinjimmy sorry to disturb you but i think you can help me maybe?
I still don’t know how to make rewarded video, I don’t even know what to try else to make it work :confused:


#3

you need to check isAvailable('rewarded') before show it

if(cc.sys.isMobile) {
    if (sdkbox.PluginAdMob.isAvailable('rewarded'))
        sdkbox.PluginAdMob.show('rewarded');
    else
        sdkbox.PluginAdMob.cache('rewarded');
}

#4

Hi, thanks for the reply,
even with this, nothing happen. I’ve tried again to cache at the begining of my game, then play for 20 min and try the button linked to this function

> showRewarded: function() {
>         if(cc.sys.isMobile) {
>             if (sdkbox.PluginAdMob.isAvailable('rewarded'))
>                 sdkbox.PluginAdMob.show('rewarded');
>             else
>                 sdkbox.PluginAdMob.cache('rewarded');
>         }
>     },

and nothing happened.
Then I was wondering if it was on cache (although the app doesn’t seem to become heavier when i check on my phone), and i’ve made these to test out

update (dt) {
        if(cc.sys.isMobile) {
            if (sdkbox.PluginAdMob.isAvailable('gameover')){
                this.testInter.string = 'Inter A';
            }
            else{
                this.testInter.string = 'Inter NA';
            }
            if (sdkbox.PluginAdMob.isAvailable('rewarded')){
                this.testReward.string = 'reward A';
            }
            else{
                this.testReward.string = 'reward NA';
            }
        }
    },

not the best way to test out i think but still the result are,
i get from “inter NA” to “inter A” in less than a second.
but I never get “reward A” and even after many minutes have passed after the cache request.


#5

http://docs.sdkbox.com/en/plugins/admob/v3-js/#implement-admoblistner

you can monitor adViewDidFailToReceiveAdWithError event

sdkbox.PluginAdMob.setListener({
    adViewDidReceiveAd : function(name) { },
    adViewDidFailToReceiveAdWithError : function(name, msg) {   cc.log(msg);    }, // why failed
    adViewWillPresentScreen : function(name) { },
    adViewDidDismissScreen : function(name) { },
    adViewWillDismissScreen : function(name) { },
    adViewWillLeaveApplication : function(name) { },
    reward(name, currency, amount)
});
  1. use google test ad id

Android: Rewarded Video ca-app-pub-3940256099942544/5224354917
iOS: Rewarded Video ca-app-pub-3940256099942544/1712485313


#6

Hey, i forgot to say that I found out the “issue”.
For those who have this same issue, try this:
So as I said, i already used the test ID provided by google, and i checked it many times just to make sure there was nothing wrong, i checked every piece of my code too, and they were pretty ok. So i was about to give up, I set up my release app to show interstitial instead of rewarded video, but i keep the debug version installed on my phone, from time to time, i try if by any chance it would work, and of course,it doesn’t. So how i fixed the problem?
It was pretty random actually and i was lucky to find it: I started to use a vpn on my phone(not related to this at all), and then i opened the game and the rewarded video worked. At first i didn’t think of the vpn, and was trying to figure out why? and after 5 min or so, it was clear that the vpn was making it works.
I don’t know why rewarded video test ad ID wouldn’t work in my country, there is no statment about it anywhere, but still, when the vpn is off, the rewarded video stop working.


#7

@yinjimmy Thanks a lot for taking your time helping me, i appreciate it very much :blush:


#8

Wow, VPN !!!

I use it too when I test AdMob.

:wink: