How do I Capture native (Menu) button presses in PhoneGap?

Posted by Dinedal on Stack Overflow See other posts from Stack Overflow or by Dinedal
Published on 2010-12-07T03:23:06Z Indexed on 2011/01/06 22:53 UTC
Read the original article Hit count: 126

Filed under:
|
|

By calling "BackButton.override();" and then hooking on to the backKeyDown event, I am able to get the back button press to register.

But there doesn't appear to be a "MenuButton.override();" Also, hooking on the menuKeyDown doesn't register a button press.

Here's my (non-functional) code. What am I missing?

<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>      

  <script type="text/javascript" charset="utf-8">
        document.addEventListener("deviceready", function() {

            alert('initialized');
    }, false);
    document.addEventListener("menuKeyDown", function() {

            alert('menu_pressed'); // Never happens
    }, false);
  </script>

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about android