Admob not showing test ad

Admob not showing test ad
0.0 0

#1

Hi,

I’m implementing my first game with sdkbox+admob. I’m using cocos2d-x v3.10 and just downloaded sdkbox-admob this week.

After testing, my code only shows real ads, no test ones. My code:

AppDelegate.cpp

bool AppDelegate::applicationDidFinishLaunching() {
       #ifdef SDKBOX_ENABLED
            sdkbox::PluginAdMob::init();
            sdkbox::PluginAdMob::setTestDevices("my test device code ID");
            sdkbox::PluginAdMob::cache("test banner");
        #endif

And in TestScene.cpp, inside a callback func called from a menu button:

sdkbox::PluginAdMob::show("test banner");

If i press the menu button too quick, banner isn’t shown as it’s still being cached. I’m ok with that as I plan to implement a listener to check when the banner is ready and show from the listener. What worries me is that it only shows real ads, no test ones.

What should I change? As you can see, I call setTestDevices() before caching


#2

Hello @ishmar

I have checked this particular issue some days before.
we found it to be working, but let me double-check it.

FEATURE:
We also had a feature of config change of bool value to enable the test device, but that seems not to be there in the current production build.

Let me check this and get back to you soon.

Best,
Pabitra


#3

Hello @pabitrapadhy,

Thanks for your fast answer. I’ve tried with another device, I’ve replaced my test device code ID with the one for the new device, but got no test ad in new device either.

I’ve checked all steps given in the Manual integration For Android Wiki and everything seems fine. I’ve checked my plugin version, and it’s sdkbox-admob_v2.1.2.7

Hope that helps in your tests.

Thanks in advance


#4

How many symbols in your device id? Today I was faced with a similar problem - the app from the store showed the identifiers longer than 16 characters, whereas the correct ID is consisted of 32.


#5

Sorry for the trouble.
Anyway we are checking up the release of the new feature.
If it’s already available, I will list you down the steps and will update our documentation.

If not, we will release a hot-fix or a new release with the feature.

Best,
Pabitra


#6

Thanks for all your replies.

@chmyaf my device ID is 32 characters long. I’m still developing the app so it’s not published in the store yet. The only codes I’ve are the one I read from logcat and put in setTestDevices() and the one got from admob for the banner and that is stored in my sdkbox_config.json and, as stated before, guess last one is working properly as I can see a real banner in my app.

@pabitrapadhy Thanks for the info. I’ll be off until next week, I’ll check back for info on monday :smile: Btw, have you managed to reproduce the error? Do you need more info?


#7

ah… nope
was not able to reproduce it.

I will update you in mean-time, with our new release.


#8

@ishmar @chmyaf

Actually if you set your test id of Admob
in sdkbox_config.json

add a parameter in the field like this -

 "home": {
                    "width": 300, 
                    "type": "banner", 
                    "id": "ca-app-pub-1329374026572143/3847466511", 
                    "alignment": "bottom", 
                    "height": 50,
                    "test": true
                }  

“test”: true

then it should only show test ads.
In release Admob ID, set this value to false, then it will show real ads.

Please update SDKBOX to the latest version and try this out.
Let us know, if this resolves your issue.

Best,
Pabitra


#9

Hi @pabitrapadhy,

Thanks for your support.

After doing some tests, I couldn’t manage to make it work either with my current version or after updating to newest one and modifing sdkbox_config.json to include “test”:true

Anyway, I made a new project, moved my code to it, and still same issue. Then, I did a fresh install of cocos, sdkbox, ndk & android sdk, created again a new project and moved my code to it, and this time it worked like a charm.

I’m not sure what was messing with my project, as I’ve been periodically updating ndk and sdk (different paths and executing setup.py on cocos2d-x folder), but problem now is solved.

Thanks!


#10

Hey @ishmar

May be the SDKBOX core was not updated.
that might be the reason.

We should come up with some better way to update the plugin in a forced way.
Glad it worked for you.

Best,
Pabitra


#11

In my case

sdkbox::PluginAdMob::init();
sdkbox::PluginAdMob::setTestDevices("kGADSimulatorID, 170409ea73071fafd9ce6b1e0ccxxxxx");
sdkbox::PluginAdMob::setListener(this);

then

sdkbox::PluginAdMob::cache("gameover");

and

sdkbox::PluginAdMob::show("gameover");

it always show REAL ADS, not TEST ADS, gameover is interstitial, but it’s ok with banner
Show how to solve this issue???


#12

Hi @ltgbau

setTestDevices() is deprecated. You should use test: true in your Resources/sdkbox_config.json

Please read entire post for more info.

Regards


#13

Thank you for replying me :smiley:
I tried to do the same to you but still not work.
After updated sdkbox to 2.2.0.12 i found that sdkbox_config.json must set to this to work

 "AdMob": {
        "test":true,
        "ads": {
            "gameover": {
                "type": "interstitial", 
                "id": "ca-app-pub-1329374026572143/418xxx"
            }, 
            "home": {
                "width": 0,
                "type": "banner", 
                "id": "ca-app-pub-3940256099942544/2xxx", 
                "alignment": "top",
                "height": 0
            }
        }
    }, 

The field “test”:true position is important :frowning:


#14

Hello,
Is this issue not solved yet?
I tested it on iOS but I can’t see real ads
“test”:true is set correct position
When I tested it with sample project I can’t see real ads


#15

Hi

I haven’t tested it on IOS, but for android it works flawlessly. If you put “test”: TRUE it won’t show real ads. for real ads, you need to put “test”: false

As a recomendation, I’d suggest using LiveOps for creating your JSON files. Even if you don’t use LiveOps at all, it’s still a nice way to have them created automatically and thus being well formatted.


#16

Just simply write following code ::

sdkbox::PluginAdMob::cache(“home”);
sdkbox::PluginAdMob::cache(“gameover”);

sdkbox::PluginAdMob::show(“home”);
sdkbox::PluginAdMob::show(“gameover”);

If you want to get more detail goto this link ::

http://docs.sdkbox.com/en/plugins/admob/v3-cpp/


#17

Not working for me in iOS, always getting real ad. Android works fine.

"AdMob": {
  "test": true,
  "testdevice": "7ca81224b1d962626ddc9536xxxxxxxx",
  "ads": {
    "mpaths_rewarded_admob": {
      "type": "rewarded_video",
      "id": "ca-app-pub-55886693xxxxxxxx/37xxxxxxxx"
    }
  }
},

#18

I have interesting issue. On August 7 my released Android game stopped show ads with AdMob plugin.
I tested ads with AdMob test_id and it works.

According to AdMob Android setup guide (https://developers.google.com/admob/android/quick-start) it is required AdMob APP_ID for initialize.
MobileAds.initialize(this, "YOUR_ADMOB_APP_ID");
In Cocos AdMob plugin this AdMob APP_ID is not used in setup. Just wondered isn’t it required?


#19

I have tested before. It seems that the MobileAds.initialize(this, "YOUR_ADMOB_APP_ID"); isn’t required.


#20

Yes, its works without app_id, thanks.
I also tested the game with AD_IDs from Cocos2d-x sample, and it works. Probably it some problem with my AdMob account.