Open Pause popup before game goes into background (Android)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GameVisitor

Hi there,

For pausing my games, i am using the documented way NOTIFICATION_WM_FOCUS_OUT / NOTIFICATION_WM_FOCUS_IN and it is working as expected on Desktop (Ubuntu / Android).

However, the pause popup dialog is actually getting drawn / displayed when the app is resuming and not actually right before leaving the app. Although this shouldn’t be a problem for normal cases, the problem I have is that if the user presses the home button, upon trying to resume the game, Android displays the last drawn screen (in my case, without my pause popup), which i don’t want to happen…

it seems in Android I could execute something before the process actually being taken out, or am I mistaken ?

Btw, i would prefer if there is a solution for iOs too, not just for android.

Thx in advance.