Skip to main content
kiwicodey
Participant
February 20, 2019
Question

Android Virtual Back Button

  • February 20, 2019
  • 0 replies
  • 257 views

i there,

I'm currently testing my games on the device Mi A2 Lite. This Android device doesn't have a physical back button but a virtual navigation bar.

I used to get the event of the physical back button being pressed with the following code.

NativeApplication.nativeApplication.addEventListener( flash.events.KeyboardEvent.KEY_DOWN, onKeyDownSettings, false, 0, true );

protected function onKeyDownSettings( event:flash.events.KeyboardEvent ) : void

{

   if( event.keyCode == Keyboard.BACK )

{

event.preventDefault();

event.stopImmediatePropagation();

}

}

Unfortunately this code doesn't work anymore with my new Android device. I think this could be related to some new Android devices like the Mi A2 Lite. Do you know any solution to get the event of the virtual Back Button being pressed and fix this issue? Thanks!

This topic has been closed for replies.