Heyzap + Phaser + Cocoon

Hi I have used Cocoon for packaging my game for both android and ios. I have a problem though the game is not showing interstitials. There are no error bugs. Please have a look at my code. Thanks.

document.addEventListener(“deviceready”, function () {
setTimeout(function () {
if (window.cordova) {
initGame();
configureHeyzap();
if(heyzapService){
//Cocoon.Ad.Heyzap.showDebug();
createHeyzapInterstitial();
}
}
}, 100, false);
});

function configureHeyzap(){
heyzapService = Cocoon.Ad.Heyzap;
console.log(heyzapService);
heyzapService.configure({
ios: {
publisherId:“fca8597331225da69e2768329f5804d7”
},
android: {
publisherId:“fca8597331225da69e2768329f5804d7”
}
});
}
function createHeyzapInterstitial(){
heyzapInterstitial = Cocoon.Ad.Heyzap.createInterstitial();
heyzapInterstitial.on(“load”, function(){
console.log(“Interstitial loaded”);
});

heyzapInterstitial.on("fail", function(){
console.log("Interstitial failed");
});

heyzapInterstitial.on("show", function(){
console.log("Interstitial shown");
});

heyzapInterstitial.on("dismiss", function(){
console.log("Interstitial dismissed");
});

}

function showHeyzapInterstitial(){
if(heyzapInterstitial != undefined){
console.log(heyzapInterstitial + ‘heyzapInterstitial’)
heyzapInterstitial.load();
heyzapInterstitial.show();
}
}

I don’t use cocoon but If you plan to use cordova instead I have some interesting examples and tutorials (in french)

Thanks @nazimboudeffa Can you share the link? Will try the translation

You’re welcome, so here is the link to the cordova game tutorial (in french) https://www.youtube.com/watch?v=lsCwMjZXOo4 and I’ve made a second little game you’ll find the code on my github account

Ahh I thought the tutorial is in text :smiley: Thank you very much!

It’s a live in fact I didn’t edited the video, so you see me coding as it is :slightly_smiling_face: I’ve added the link to the repo in the description :wink:

Would be nice to have this in english :slight_smile:

Here it is https://medium.com/@nazimboudeffa/cordova-phaser-2-ce-8051bd9d3949

1 Like