Detect if app is "Minimized"

Is there any way to detect if an app is minimized? Also is it possible to detect when an app is resumed?

No, you canā€™t really detect it now. I know that itā€™s in the backlog and scheduled for implementation in the coming one or two releases.

But does the engine handle any of this internally? It is very important when an app is minimized to:

  • Pause all (most) activity
  • Pause sound (especially long or looping sounds)
  • Reducing activities that consume CPU in the background
  • Stop rendering
    etc

(maybe I should read the docs first :wink: )

Yes the engine takes care of pausing everything. The game wont be running in the background or anything like this.

@britzl Is there any update on this feature? I know the game auto ā€œpausesā€, but I have a custom pause screen that Iā€™d like to show if the app is minimized on a phone, so that when the player returns they arenā€™t immediately put back into the game (they have to click a ā€˜unpauseā€™ button)

Hmm, @AGulev and @andreas.strangequest, did you solve your issues with detecting pause? I think @Mathias_Westerdahl concluded that WINDOW_EVENT_FOCUS_LOST should be triggered when the game is paused which should be what you need @therondevelopment to show a pause screen when coming back. But maybe there was an issue with the event not being triggered?

1 Like

I am using WINDOW_EVENT_FOCUS_LOST and have no any issue with it.

@Dragosha told something about issue, but I never reproduced it.

2 Likes

donā€™t forget that different verisons of Android works different. I used Android 7.1 for test. And my phone catches WINDOW_EVENT_FOCUS_LOST when app gains focus back.

3 Likes

Great Iā€™ll try that. Thanks!

2 Likes