Friday, 15 July 2011

android - Interstitial ads for cocos2d-x -



android - Interstitial ads for cocos2d-x -

this question exact duplicate of:

how display interstitial ads after game ends

i new cocos2d-x. developed game in xcode using cocos2d-x , ported android. want utilize interstitial ads after game ends & when replay. should display on game on screen. using next code display ads. displayed before starting game , never displayed when replay game.

once quit , restart advertisement shown 1 time before starting new game. can please help me find solution?

protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); interstitial = new interstitialad(this); interstitial.setadunitid("***********"); adrequest adrequest = new adrequest.builder().build(); interstitial.loadad(adrequest); interstitial.setadlistener(new adlistener() { public void onadloaded() { displayinterstitial(); } }); } public void displayinterstitial() { if (interstitial.isloaded()) { interstitial.show(); } }

the problem phone call displayinterstitial() in oncreate(). need phone call later on when game over. modify oncreate() prevent advertisement appearing immediately:

protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); interstitial = new interstitialad(this); interstitial.setadunitid("***********"); adrequest adrequest = new adrequest.builder().build(); interstitial.loadad(adrequest); }

and later game on phone call displayinterstitial() show ad.

since barely gave info cannot give improve answer.

android c++ xcode5 cocos2d-x

No comments:

Post a Comment