I'm currently struggling with this issue. I need to check if the device, where the app is installed, has a hardware menu key. Because it is not existing on some devices like Galaxy Nexus, I'm showing it directly in the UI in this case.
I have already looked at PackageManager.hasSystemFeature(), but didn't find anything useful there.
Has anyone already done this?
keysoft qualifier is used to detect a hardware keyboard not the navigation bar.
This article solves it:
Check for navigation bar
Even on devices running Honeycomb and later, the system will supply a “Menu button” for apps written for 2.x versions of Android. Only it’s called the “overflow menu”. So there’s no point checking whether there will be such a button or not—it will be there if it’s needed.
As a general guideline, you should check for specific functionality, not look at system/API version numbers. Use the ActionBar class if it’s available, otherwise fallback to the 2.x options menu.
Have you looked at Google’s action-bar tutorial? That makes it clearer what you should be doing.
See
ViewConfiguration#hasPermanentMenuKey()
for more information. Note that this is only available for API level 14+ (Android 4.0 Ice Cream Sandwich or newer).I think a possible and better solution is to add a own actionbar. So every device can see it and you don't have to check hardware configuration or Api version.
If you want a resource qualifier, which might be the case since you want to differentiate UIs, use
keyssoft
resource qualifier.