Android Phonegap App - menubutton event sometimes doesn't fire

Im using Telerik AppBuilder with Cordova 3.5 version and the following code to provide physically back and menu buttons on android devices:

var app;

function onLoad()
{
    document.addEventListener("deviceready", onDeviceReady, false);
}

function onDeviceReady()
{    
    app = new App();

    app.run();

    document.addEventListener("backbutton", onBackBtn, false);
    document.addEventListener("menubutton", onMenuBtn, false);                    
}            

function onBackBtn()
{
    app.goToPrevView();
}

function onMenuBtn()
{
    app.menu.toggle();
}  

      

But sometimes the menubutton event is only triggered on a double tab by a menu key on Android v4.4.4 running on my Motorola G.

Maybe it has to do with the virtual keys on this device?

+3


source to share





All Articles