Proper way to handle app going into the background


Do I need to implement the pause(), resume(), unloadTextures() and reloadTextures() to properly handle my app going into the background on Android or is this all handled by OF?

What I’m currently seeing is that I return to a black screen when the app comes back from the background state.


In the pause();

  • Pause sounds
  • Pause videos and musics
  • Disable ofLights
  • Clean ofxAssimpModelLoader models

In the reloadTextures();

  • load ofImages and ofTextures
  • load ofTrueTypeFonts
  • load ofxAssimpModelLoader models,
  • load ofxAndroidSoundPlayer sounds
  • load ofxAndroidVideoPlayer videos and musics
  • prepare ofLights

Thanks, Rancs. Are ofImages and ofTextures automatically released when the app goes into the background?

Yes. I remember OF also automatically reload them. But i had issues in some cases, so i reload them to avoid crashes. You can test your own case.

Ah I forgot to say; if you have no error message in the logcat for an unloaded image/texture, the reason of the black screen is probably a light.

I’m assuming I also have to reallocate any FBOs I’m using?

Actually… I went ahead and disabled everything. I’m just clearing the background to red. When the app goes into the background and comes back, the clear color is no longer visible…

Any idea what might be going on?


I placed a log line in my draw() and it’s not being called after the application resumes. What could be causing this? I’ll dig through the ofxAndroid code in a bit to see what’s going on.