4ian / GDevelop

🎮 Open-source, cross-platform 2D/3D/multiplayer game engine designed for everyone.
https://gdevelop.io
Other
10.81k stars 848 forks source link

Admob adverts not working #382

Closed nerdite closed 6 years ago

nerdite commented 7 years ago

Hi there,

Thank you so much for fixing the crash issue when adding the admob banner. Now we have an entirely different issue. I followed the tutorial on the website installing the cordova admob plugin. I then export and test the game in my emulator and on my phone... but no adverts show.

My banner advert is set to show on startup on my second scene... but nothing shows up. Any ideas?

nerdite commented 7 years ago

Still thinking?

Kaytchup commented 7 years ago

Copy and paste this code into the Javas Script file (obviously editing it by putting in your app ID/ publisher ID). This will make the banner appear on the bottom of the screen. You can go to other help sites on how to edit it and place it on other locations. But for now I used this.

document.removeEventListener('deviceready', onDeviceReady, false);
    // Set AdMobAds options:
    admob.setOptions({

        publisherId: "insert your app id here (if it doesnt work use publisher ID)",  // Required

    });
    admob.createBannerView();
}
document.addEventListener("deviceready", onDeviceReady, false);
admob.createBannerView();

For some reason Gdevelop admob plugin doesnt work doesnt work anymore.

Benji64 commented 7 years ago

Hi, can you tell me where the file is and as it is called? Can you also explain or place this part of the code in the file?

Kaytchup commented 7 years ago

I'm guessing that you export to Apache Cordova right? So where it converts to (the project folder) go in there, and then to another folder called www, in there there should be a file called 'code' open it with notepad or whatever and put the code at the end. Then save it, and it should be all ready to go!

Benji64 commented 7 years ago

I use intel XDK with cordova. the first correction of 4ian was to do:

open the file called admobruntimeobject.js in this folder: / JsPlatform / Runtime / Extensions / AdMobObject Paste this at the end: gdjs.AdMobRuntimeObject.prototype.setLayer = function (layer) {       // No renderable object };

gdjs.AdMobRuntimeObject.prototype.setZOrder = function (z) {       // No renderable object }; Save the file Start again GD, open your project and launch a preview.

if I put your code in this file, it blocks again the download

Kaytchup commented 7 years ago

Have you put the admob plugin tag in the .xml file?

Plus does XDK still work? I thought they stopped supporting it?

Benji64 commented 7 years ago

the soft XDK still work but not the cloud service to build mobile app. To build mobile app I use cordava cli.

4ian commented 6 years ago

Closing this. If there is still an issue, please upload a sample game so that it's easy to test and fix :)