Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic/Cordova menubutton event not called

I am trying to monitor the Menu Button on Android (4.4.2 - Samsung S3), but the Ionic event (nor the underlying Cordova event) is not firing:

$ionicPlatform.on("menubutton", function () {
  // do our stuff here (never gets called)
});

Has anyone been able to make this work? Running Ionic platform 1.0.0, and all other events are firing as expected.

like image 338
Unpossible Avatar asked Jun 11 '15 20:06

Unpossible


1 Answers

The docs are missing a 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

like image 101
Alien Technology Avatar answered Oct 15 '22 14:10

Alien Technology