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 ).
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]var 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();
}[/code]
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:
<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!