Suspend and Restart Regularly Loading - fan-ADN/nendSDK-cocos2d-x GitHub Wiki
Hiding ads and suspending regularly loading
Banner ad and icon ad (only for Android)
When you do not want to display ads on the screen or the scene itself is not displayed, send pause message, suspend regularly loading and hide the ads.
Also when the app is opening on the background, you have to implement it in AppDelegate.cpp as well to suspend the regularly loading.
Ex.) Suspend regularly loading and hide ads when the screen covered
void HelloWorld::onExit() {
CCLayer::onExit();
NendModule::pause();
NendModule::hideNADView();
NendIconModule::pause();
NendIconModule::hideNADIconView();
}
Ex.) Suspend regularly loading when app is opening on the background.
void AppDelegate::applicationDidEnterBackground() {
NendModule::pause();
NendIconModule::pause();
}
Redisplay ads and restart regularly loading
Banner ad and icon ad (only for Android)
When want to redisplay ads on the screen or call the scene itself, send resume message, restart regularly loading and redisplay ads.
Ex.) Restart regularly loading and redisplay the ads when the screen shows up
void HelloWorld::onEnter() {
CCLayer::onEnter();
NendModule::resume();
NendModule::showNADView();
NendIconModule::resume();
NendIconModule::showIconNADView();
}
Ex.) Restart regularly loading when the app comes into foreground.
void AppDelegate::applicationDidEnterBackground() {
NendModule::resume();
NendIconModule::resume();
}