These are the functions to be implemented in your Application Delegate class. The first function gets called when application goes background, and second one is called when application resumes.
void CCApplication::applicationDidEnterBackground();
void CCApplication::applicationWillEnterForeground();