Interstitial Ad - fan-ADN/nendSDK-cocos2d-x GitHub Wiki
Preparation
If you have not yet register app/ad placements nor downloaded SDK, please refer to following link.
SDK Implementation
Add SDK/Module to a project.
Display Interstitial ad
Implement the program to display Interstitial ads into the source file of Cocos2d-x.
Please follow the instruction below.
Add header file to the source file of Displaying ad scene.
Add header file to the source file of Displaying ad scene
Ex.) HelloWorldScene.cpp(part of it)Parts from the header file
#include "HelloWorldScene.h"
#include "NendInterstitialModule.h"
USING_NS_CC;
CCScene* HelloWorld::createScene() {
...
}
Start Loading
Select the start loading method.
Ex.) HelloWorldScene.cpp(part of it)- HelloWorld::init()
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
...
// add the sprite as a child to this layer
this->addChild(pSprite, 0);
char interstitialApiKey[] = "apiKey published on dashboard";
char interstitialSpotID[] = "spotID published on dashboard";
NendInterstitialModule::createNADInterstitial(interstitialApiKey, interstitialSpotID);
return true;
}
Call Displaying Ad Process
Select Displaying ad methods.
For more information, please refer to The Contents of NendInterstitialModule.
The Interstitial ad will not be displayed if it is not fully uploaded.
Ex.) HelloWorldScene.cpp(part of it)-
// example of displaying interstitial ads with a click
bool HelloWorld::showButtonClick()
{
NendInterstitialModule::showNADInterstitialView();
}
About Screen Rotation
For Android, please set up by following nendSDK Android setting guidelines.