Application Entering Background and Entering Foreground


I’ve searched the forum and found some topics that discussed the potential for detecting when an application enters and exits background/foreground…

function appEnteredBackground()

function appEnteredForeground()

This would be very useful for applications involving the physics engine, since it uses a calculation stepper, which essentially simulates it running in the background when your application resumes foreground execution.

Simply being able to put physics pause and resume in these example functions would be incredibly helpful.

Any thoughts or workarounds?


I’m not sure anything has been added to detect background/foreground usage and I’m not sure if anyone ever found a way to do it reliably either.

@johnpoore physics should be pausing and resuming on those events automatically. If not then that’s a bug in Codea. (Though I’m open to the idea of making those events available in the Codea API too.)

@Simeon Physics calculations/objects don’t pause when moved to the background. At least not in the example I tried.

I think it’s a good idea to expose these events, especially as iPads now support dual windows and multi tasking.

I agree with everyone on this thread. It’s definitely not pausing, so if it should be, it’s a bug. I also agree that exposing these events would be helpful. Probably not a big deal in the Codea App but as people use Codea as a serious development platform, having access to these types of events would be very useful. Hopefully the bug is an easy fix!

Another observation on this topic… Physics also does not pause when you pause Codea in the Codea development environment. @Simeon, do you think any/some of this will make it into the next update? Or it too complicated a change?