Page 1 of 1

Admob interstitial is not working...

PostPosted: Mon 7 Dec 2015, 20:53
by xai1985
Admob interstitial is not showed no matter what, here you can see all i try and nothing.

viewtopic.php?f=19&t=7303

Also the banner doesn't aply the size nor the x-y position, it aplys the bottom position and the top position and this one is working.

Re: Admob interstitial is not working...

PostPosted: Fri 25 Dec 2015, 10:49
by xai1985
HEEEEY!!!!

Hope this post is saved for the community!! IAN, VICTOR, LIZARD-13, anyone must save this one because seems that nobody knows how to use interstitial (or don't wanna help :cry: ).
I realized how to use the admob with the Gdevelop games so, i'm gonna write it here as complete as i can...

--1 THE ADMOB ACCOUNT--
You now you have to do a profile in google, and in admob, bla bla bla, and then, win money with your aplication (i have it in spanish so i don't know what says in english control panel of admob), well, so we choose to add one aplication manually and we choose the future name of our aplication, the platform (android or ios or windows phone) then we create the banner and the interstitial.

--2 THE BANNER IN OUR GAME--
The banner is in fact working with the own programation of the program gdevelop, you only need to use the admob objects like this:
1.- Create an admob object.
2.- Name it "banner1" for example.
3.- Write the banner android number id and the ios number id you have from your admob account, and select "Overlap game" and "Show banner on start up", and also choose if you like it at the top, or the bottom of your game.
4.- Put the object into the scene.
6.- With a condition "At the beginning of the scene" use the action "Hide banner ad of banner1".
7.- Whenever you wanna show it, use the condition "show banner". (you can use timers to set the time the banner is show combining it like: "if timer banner > 0.1s" -> show banner, "if timer banner >5s" -> hide banner.

--3 SHOW INTERSTITIAL--
There is any kind of bug or problem with the program, so we have to do it manually.

-3.1, programming interstitial inside of gdevelop-
We are gonna load the interstitial at the beginning of the scene, so we are gonna use the condition "at the beginning of the scene" and then, we gonna add a subevent, and we gonna choose add->javascript code, and we write or copy the next sentence:

if(AdMob) AdMob.prepareInterstitial( {adId:admobid.interstitial, autoShow:false} );

And now we are gonna use the condition to show it, so we decide when to show it, let's see when we finish the game, and it's a game where we kill/beat enemies, so we can do some condition like, "var enemies = 0" and then we gonna add a subevent, and we gonna choose add->javascript code, and we write or copy the next sentence:

if(AdMob) AdMob.showInterstitial();

That's all we need to write in our project, you have to do it in every scene you have and you wanna show the interstitial ad.

-3.2, ad a new file to our project-
We need to ad a .js file to our project to load somethings, so we create a .js file and write this:

Code: Select allvar admobid = {};
if( /(android)/i.test(navigator.userAgent) ) {
    admobid = { // for Android
       //banner: 'ca-app-pub-2903840155508808/6871334976',
        interstitial: 'ca-app-pub-2903840155508808/1121435375'
    };
} else if(/(ipod|iphone|ipad)/i.test(navigator.userAgent)) {
    admobid = { // for iOS
        //banner: 'ca-app-pub-6869992474017983/4806197152',
        interstitial: 'ca-app-pub-2903840155508808/5551634972'
    };
} else {
    admobid = { // for Windows Phone
        banner: 'ca-app-pub-6869992474017983/8878394753',
        interstitial: 'ca-app-pub-6869992474017983/1355127956'
    };
}

if(( /(ipad|iphone|ipod|android|windows phone)/i.test(navigator.userAgent) )) {
    document.addEventListener('deviceready', initApp, false);
} else {
    initApp();
}


If you don't know how, create a .txt file, and change the .txt for .js and it'll be a .js file, the "//" in the file means a comment, let it in the banner to be sure it doesn't crash with the banner id we are using in the program gdevelop.
With this file, you just change the interstitial id for yours and that's it, i attachad the file anyway.

-3.3, one last modification in our programation-
The last part, when we have everything ready to use it into the Intel XDK, be sure to write inside of the file index.html from the folder www the next sentence:

Code: Select all<script type="text/javascript" src="admob.js"></script>


Be sure to put this file javascript in the root of the www folder, and also watch the name of this javascript, if it's admob.js, you use this sentence i just write above, if not you know that you only have to change the "src="admob.js" for the name you are using.

--4, last admob and playstore configuration--

Once you have create your play google account and correctly upload your game "it could take 5-6 hours to be shown in the playstore" then, probably in another 24 hours you'll be able to "link" your admob ads to your game by clicking "link your aplication" in your admob control panel, then just write the name of your aplication, and if it's shown, you'll be able to link it, and it'll begin to count the impresions and clicks and begin to make some money XD

----------------------------------------------------------------------------------------------------

With this info, you are able to use the banner and the interstitial of admob, is quite easy, so, what are you waiting for? Begin to create your crazy game and share it with all the community! :D

Help ?

PostPosted: Fri 20 Jan 2017, 17:23
by Laminou
Hi,
Thanks for your help, but I still find a problem
I followed the steps you discribed above exactly, but when I put the admob banner in the scene and then lunch it in a browser it blocks and nothing else, but if I create the admob object and I don't put it in the scene the games lunch correctly ! :?

Can you help please ? :)

Re: Admob interstitial is not working...

PostPosted: Wed 1 Feb 2017, 13:42
by Lizard-13
Hi, I have sticked the topic for now and moved it to the help section (a better title is needed), but a tutorial on the wiki would be a good idea too. Anyway thanks, the tutorial seems great, sadly I can't test it now :roll:

Re: Admob interstitial is not working...

PostPosted: Wed 8 Nov 2017, 19:10
by JMaxx
xai1985 wrote:HEEEEY!!!!


--3 SHOW INTERSTITIAL--
There is any kind of bug or problem with the program, so we have to do it manually.

-3.1, programming interstitial inside of gdevelop-
We are gonna load the interstitial at the beginning of the scene, so we are gonna use the condition "at the beginning of the scene" and then, we gonna add a subevent, and we gonna choose add->javascript code, and we write or copy the next sentence:

if(AdMob) AdMob.prepareInterstitial( {adId:admobid.interstitial, autoShow:false} );

And now we are gonna use the condition to show it, so we decide when to show it, let's see when we finish the game, and it's a game where we kill/beat enemies, so we can do some condition like, "var enemies = 0" and then we gonna add a subevent, and we gonna choose add->javascript code, and we write or copy the next sentence:

if(AdMob) AdMob.showInterstitial();



It's works, thank you. But another question - how to define the end of the interstitial video?

Re: Admob interstitial is not working...

PostPosted: Sun 7 Oct 2018, 21:08
by vectrex71
With all the respect, it's now almost the end of 2018. May I friendly ask, is this problem still a thing? Or does it work in the meantime !?

Thanks !