Phonegap cordova native android menubutton does not shoot

I had a problem launching my own menu button on Android through the Cordova 4.0.0 phonebook. I also implemented a back button and it works great. I cannot understand what is wrong here. This seems to be ok according to the cordova docs. This fails when running tests on the 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'); } 

code>

And the init function is called after loading, and, as I mentioned, onBackKeyDown works. Any hints appreciated.

+5
source share
1 answer

This was supposedly fixed, but an undocumented string is still required.

 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

+3
source

Source: https://habr.com/ru/post/1205052/


All Articles