in PlayAssetDelivery/NativeSample/Teapot/src/main/cpp/TeapotNativeActivity.cpp [265:297]
void Engine::HandleCmd(struct android_app *app, int32_t cmd) {
Engine *eng = (Engine *) app->userData;
switch (cmd) {
case APP_CMD_SAVE_STATE:break;
case APP_CMD_INIT_WINDOW:
// The window is being shown, get it ready.
if (app->window != NULL) {
eng->InitDisplay(app);
eng->has_focus_ = true;
eng->DrawFrame();
}
break;
case APP_CMD_TERM_WINDOW:
// The window is being hidden or closed, clean it up.
eng->TermDisplay();
eng->has_focus_ = false;
break;
case APP_CMD_STOP:break;
case APP_CMD_GAINED_FOCUS:eng->ResumeSensors();
// Start animation
eng->has_focus_ = true;
break;
case APP_CMD_LOST_FOCUS:eng->SuspendSensors();
// Also stop animating.
eng->has_focus_ = false;
eng->DrawFrame();
break;
case APP_CMD_LOW_MEMORY:
// Free up GL resources
eng->TrimMemory();
break;
}
}