ANDROID: Save the game when the process is paused

The OS can kill the activity at will after onPause() or onStop()
to free up memory for other application. Provide a parachute when
the engine allows it.
This commit is contained in:
dhewg 2011-03-07 19:52:44 +01:00
parent 42c6a785c7
commit 1f90d232e3

View File

@ -631,7 +631,13 @@ void JNI::setPause(JNIEnv *env, jobject self, jboolean value) {
if (g_engine) {
LOGD("pauseEngine: %d", value);
g_engine->pauseEngine(value);
if (value &&
g_engine->hasFeature(Engine::kSupportsSavingDuringRuntime) &&
g_engine->canSaveGameStateCurrently())
g_engine->saveGameState(0, "Android parachute");
}
pause = value;