I'm having trouble firing the native menu button on Android through Cordova phonegap version 4.0.0. I have also implemented the back button and it's working fine. I'm not able to figure out what's wrong here. Seems ok according to the cordova docs. This fails when running tests on a Samsung S4.
init : function () {
document.addEventListener("deviceready", this.onDeviceReady, false);
},
onDeviceReady : function() {
// Register the event listener
document.addEventListener('backbutton', this.onBackKeyDown, false);
document.addEventListener('menubutton', this.onMenuKeyDown, false);
},
onMenuKeyDown : function(event) {
alert('menu phone home');
}
And the init function is invoked after load, and as I mentioned onBackKeyDown works. Any hints appreciated.
This was supposedly fixed, but still requires an undocumented line.
document.addEventListener("deviceready", function() {
...
navigator.app.overrideButton("menubutton", true); // <-- Add this line
document.addEventListener("menubutton", yourCallbackFunction, false);
...
}, false);
https://issues.apache.org/jira/browse/CB-9949#comment-14989073
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With