I would like to detect if the phone running my Android application uses hardware buttons or virtual buttons (Galaxy Nexus).
Is there a way to get this information?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Since API level 14 you can use ViewConfiguration.hasPermanentMenuKey() to detect if a device has a permanent menu key.
Generally, virtual and physical buttons are mutually exclusive, so this would help you. Example:
WARNING: There are some cases in which this won’t help you. For example, say a manufacturer decides to use virtual keys along with physical menu keys; then this method wouldn’t help you. Another case would be if the phone has no virtual keys and no physical menu key (e.g. Samsung S5).