Problem with Back Key and native popup windows...

I have the following problem:

When showing a native popup window and then using the BACK key on device the popup is closed BUT I don’t get inside the listener for the BACK key with this first click! This means I don’t know where to access this kind of “event” for closing the popup by using the BACK key.

Runtime:addEventListener( “key”, _G.onKeyEvent )

The function _G.onKeyEvent is not getting accessed when closing the native window by using the BACK key.

My problem is the following:

I show a native window with some information. A user now can use the BACK key on device to close the button. He also can click on a shown button on screen. With the last option the game starts normally. When using the device BACK key just the window disappears BUT I don’t know how to check the event, so I can start the game.

Any help, ideas? All help welcome!!!

I would create a variable, like  isPopupOpen = true/false, and then check in a key event listener if the popup is open when back button is pressed and then do whatever it is that you need to do.

thanks for your help. I already had this kind of “solution” BUT it wasn’t working because I don’t get a key event for the key listener when closing the popup with the device Back button.

I now found out why this is happening: The native popup was showing two buttons which also are using an onComplete listener. I now found out using the devices back button is activating the onComplete listener instead the key listener. So I just wrote my function call in the onComplete listener of the native popup and now it is working fine.

:slight_smile: