Add Admob to Ejecta the easy way ?

For developers using the Construct 2 Javascript SDK

Post » Tue Jun 17, 2014 1:00 am

hi
sorry for my bad english :D
so i found some one that make admob extension for Ejecta
https://github.com/finscn/Ejecta
and it is work !
and you just need to add this code to index.js
Banner code
Code: Select all
initAdMob= function() {
   
    var ad = new Ejecta.AdMobBanner("your admob app id ");
   
    /* Type:
     banner,
     mediumrectangle,
     fullbanner,
     leaderboard,
     skyscraper,
     portrait,
     landscape,
     invalid
     */
    ad.type = "banner";
    ad.x = 100;
    ad.y = 0;
   
    ad.onload = function() {
     console.log("load")
 
       
        ad.show(); // display ad
        // ad.hide()
       
    }
    ad.onclose = function() {
        console.log("closed")
    }
    ad.onclick = function() {
        console.log("clicked")
    }
   
    ad.load();
}
// call the ad after 1 sec of the game finish loading ,
// it will not work if you not wait 1 sec i do not know why
setTimeout(function(){initAdMob()},1000);



Fullscreen Code

Code: Select all
// fullscreen ad
var adPage = new Ejecta.AdMobPage("Your AppId of AdMob");
adPage.onload = function() {
    console.log("loaded")
    adPage.show(); // can't hide it via code
}
adPage.onclose = function() {
    console.log("closed")
}
adPage.onclick = function() {
    console.log("clicked")
}
adPage.load();


if i add this code in the start of the index.js the ad will appear right at the beginning of the game
but i need to control when to show it or hide
so can any one add this to the ejecta plugin like iAd or make plugin for this code


I think that many here will love to use admob with admob 100 % fill rate
B
8
S
1
Posts: 3
Reputation: 1,101

Post » Tue Jun 17, 2014 2:13 pm

How to do this to Crosswalk?
B
25
S
7
G
2
Posts: 64
Reputation: 2,624

Post » Tue Jun 17, 2014 2:31 pm

igalencar wrote:How to do this to Crosswalk?

try this
https://github.com/crosswalk-project/cr ... -Crosswalk
B
8
S
1
Posts: 3
Reputation: 1,101

Post » Wed Jun 18, 2014 12:04 pm

TO do this i need to build it outside intel XDK (that is my main build tool now), so i need to do all over crosswalk native right?
B
25
S
7
G
2
Posts: 64
Reputation: 2,624

Post » Sat Jun 28, 2014 2:30 pm

any one :(
B
8
S
1
Posts: 3
Reputation: 1,101

Post » Tue Aug 19, 2014 4:06 pm

Oh man, this is exactly what I need at this moment. I wish I knew how to implement it.
B
33
S
9
G
3
Posts: 493
Reputation: 4,042

Post » Fri Nov 14, 2014 9:57 am

Sorry to necromance this topic, but @mkhater have you found a way to call the fullscreen ads at any time in the game? I'd really like to implement this into my games :D
B
19
S
5
G
2
Posts: 91
Reputation: 4,507

Post » Wed Mar 18, 2015 7:10 pm

sorry, when i add this code, although i include my appid from admob another error appears saying ¨TypeError: undefined is not a constructor (evaluating 'new Ejecta.AdMobPage("Your AppId of AdMob")') at line 22203 in index.js¨can someone help me please!!!???
B
6
S
1
Posts: 38
Reputation: 538


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests