nspire-emus / firebird

Multi-platform emulator of TI Nspire calculators
GNU General Public License v3.0
665 stars 66 forks source link

Android background save #325

Open BakedCrossiant opened 9 months ago

BakedCrossiant commented 9 months ago

When Android closes the app for power management purposes, there is no snapshot saved. For some reason this also causes the loss of files in the documents folder, aside from the Scratchpad.

Vogtinator commented 9 months ago

The issue is that Android apps can't perform arbitrary tasks when switching away from the foreground state into the background, so it's not really possible to properly save. This is why only the back button is supported for "save on exit".

BakedCrossiant commented 9 months ago

It's not possible when onStop() is called to run a snapshot saving subroutine?

Vogtinator commented 9 months ago

IIRC last time I tried that (the Qt equivalent is reacting to state == Qt.ApplicationSuspended), it didn't really work. It might be worth it to try again.

BakedCrossiant commented 9 months ago

Can you react to applicationStateChanged or onAboutToQuit instead in Qt?

Vogtinator commented 9 months ago

Yes, that's what I did.