Android hardware menu button


#1

Hi guys

I’m trying to open the side menu when the hardware menu button is pressed.
The example in Open side menu on hardware menu button (Android) doesn’t work for me.

Any help?

Thanks


#2

The Cordova team removed support for the menu button in their libraries a while ago, as discovered here:


#3

Thanks revie for the link.

I’d rather not monkey patch the Cordova library, the post is also from a year ago, is there a fix since then?


#4

Nope. That’s your only option, unfortunately.


#5

Ok, that’s sad news :confused:


#6

I have your solution!

You need to overwrite the android methods!

This is my code:

$ionicPlatform.ready(function() {
navigator.app.overrideButton(“menubutton”, true);
document.addEventListener(“menubutton”, onMenuKeyDown, false);

function onMenuKeyDown() {
    console.log("Menu");
}

});


#7

Brilliant, this works! :grinning: