How can I tell whether an android device has physical keys or the software navigation bar? I need to change the layout dependant on whether the software navigation is drawn.
For example the HTC Desire C has hardware keys:
I should clarify - Im looking at the navigation bar, not the keyboard. Home, back etc. I've tried:
getResources().getConfiguration().keyboard);
getResources().getConfiguration().navigation);
getResources().getConfiguration().navigationHidden);
return the same values on both devices.
How To Detect Keylogger On Android Phone. An Android keylogger will need to be download to your device in order to work. So, you’ll be able to see the file in your phone’s Downloads folder. Usually, you can find this by searching Downloads on your phone, going to your My Files app, or checking your settings.
Security features Android Keystore system protects key material from unauthorized use. Firstly, Android Keystore mitigates unauthorized use of key material outside of the Android device by preventing extraction of the key material from application processes and from the Android device as a whole.
When an Android phone battery drains quickly, it’s usually because an app or software is running in the background. In the case of Android keyloggers, they are designed to be undetectable and don’t appear as a typical phone app/software would. So at first, you may not realize a keylogger is spying on you. 2. Your Phone Is HOT
Secondly, Android KeyStore mitigates unauthorized use of key material on the Android device by making apps specify authorized uses of their keys and then enforcing these restrictions outside of the apps' processes. Key material of Android Keystore keys is protected from extraction using two security measures:
Solved by doing this the first time the app is launched and saving to preferences:
public static boolean hasSoftKeys(WindowManager windowManager){
boolean hasSoftwareKeys = true;
//c = context; use getContext(); in fragments, and in activities you can
//directly access the windowManager();
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.JELLY_BEAN_MR1){
Display d = c.getWindowManager().getDefaultDisplay();
DisplayMetrics realDisplayMetrics = new DisplayMetrics();
d.getRealMetrics(realDisplayMetrics);
int realHeight = realDisplayMetrics.heightPixels;
int realWidth = realDisplayMetrics.widthPixels;
DisplayMetrics displayMetrics = new DisplayMetrics();
d.getMetrics(displayMetrics);
int displayHeight = displayMetrics.heightPixels;
int displayWidth = displayMetrics.widthPixels;
hasSoftwareKeys = (realWidth - displayWidth) > 0 ||
(realHeight - displayHeight) > 0;
} else {
boolean hasMenuKey = ViewConfiguration.get(c).hasPermanentMenuKey();
boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
hasSoftwareKeys = !hasMenuKey && !hasBackKey;
}
return hasSoftwareKeys;
}
Here you go.. this should do what you want.
@SuppressLint("NewApi")
private static boolean hasSoftNavigation(Context context)
{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH){
return !ViewConfiguration.get(context).hasPermanentMenuKey();
}
return false;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With