On resume call


#1

Hello friends,
Does anybody know how to get onResume call for some layer…

I want to reinitialize everything when resuming…
So is there any way to detect onPause and onResume to call init again

Thank you


#2

you can try add CCNotification for some layer then post notification on Pause and resume.


#3

Thank you for the tip…
Right now my fix is through

// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground() {
CCDirector::sharedDirector()->resume();

GameManager::sharedGameManager()->runSceneWithID(kLevel1); //Restarting Scene on resuming…

// if you use SimpleAudioEngine, it must resume here
// SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
}