Is it possible in Corona SDK to create an options menu. I mean an menu that pops up when you touch the hardware button of a smartphone. I searches for it on google but i can't find something about it.
Jump to content
Most Android devices have either the hardware Menu button or a soft Menu button (personally I have never seen one without it). However, Google has been trying to get away from that and instead use the Action Bar. I'm not sure if someone has made the equivalent, but I would love to see Corona create an API for this.
Corona can detect when the option menu button has pressed via a "key" event. The key name is "menu".
Note that Rob is actually correct. Most modern "Google sanctioned" Android device no longer have a "physical" menu button. Nor a physical "search" button. Google has been deprecating support of the physical menu button as of Android 3.0 as documented via the link below. They want you to show menu options in a toolbar instead, such as via their ActionBar if you were doing native development.
On Android 3.0 and higher devices, I believe the virtual menu button only shows up on the bottom navigation bar if your app is set up to run in legacy mode. That is, it must target Android 2.3 or lower, which you don't want to do and we're not interested in supporting because you wouldn't be able to take advantage of all of the newest Android OS features.
Regarding the ActionBar, that is an Android 3.0 or higher feature only. There is zero support for it on older Android versions, such as 2.3, which is still a significant portion of the market. Because of this, I don't think it's worth investing our time into. Especially since we're more focus on providing cross-platform support between Android *and* iOS.
So, my recommendation is to go ahead and support the Menu key event, but also make sure to have a virtual menu button within your own apps for those devices that do not have a physical/virtual menu button. Odds are, you need something like this on iOS as well, because it doesn't have a physical menu button.
Anyways, I hope this helps.
Community Forum Software by IP.Board