Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am working in Phonegap/Cordova and I need to use menu to go for app settings. But I have came to know that according to [Google/Android docs][1][^], developer shouldn't use that menu button anymore. Instead, developer should use action bar for this purpose.

Beginning with Android 3.0 (API level 11), Android-powered devices are no longer required to provide a dedicated Menu button. With this change, Android apps should migrate away from a dependence on the traditional 6-item menu panel and instead provide an action bar to present common user actions.

But according to [cordova menu docs][2][^], you can always call native menu. I am trying this, but it is not working at all. This is what I have tried:

JavaScript
function onDeviceReady() {
            document.addEventListener("menubutton", onMenuKeyDown, false);
    }

    function onMenuKeyDown() {
            alert("Menu button pressed");
    }


First of all, there is no Menu button in upcoming android devices, second, this code is not working at all. I haven't tested it on old devices, OS < 4.0.

Whats the possible alternate of menu button in phonegap? Should I use ActionBar for this purpose? And if it is so, should I have to write it for every platform?


There is a plugin for [android ActionBar for cordova][4][^], but question remains same, what I have to do with other platforms?

Thanks in advance.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900