Usually, you do not need to know whether the Nav bar is vertical or horizontal, because it is automatically deducted from the measurements that you receive when you invoke this code:
Rect visibleFrame = new Rect();
mainActivity.getWindow().getDecorView().getWindowVisibleDisplayFrame(visibleFrame);
int heightOfDisplayInPixels = visibleFrame.height();
int widthOfDisplayInPixels = visibleFrame.width();
This code returns to your app the height and width of the area actually available to the app for its use. It deducts the Nav bar and the status bar from the relevant dimensions.
The only problem with the above code is that if the user happens to have the soft keyboard open, the height of the keyboard will also be deducted from the values returned. And even if you have code that closes the keyboard prior to running the above code, it can take a fraction of a second for the closing of the keyboard to be reflected in the above values. I have found that a delay (e.g., via postDelayed()) of 500 msecs is much more than enough for every test device that I personally use.
Of course, coding such a delay is a kluge with a built-in race condition. Nonetheless, the above code otherwise seems to work correctly, other than this one significant issue, and I have not found a better way to ensure that you have accurate values that account for the Nav bar correctly across all (tested) devices.
Specifically, the values returned by DisplayMetrics, while they do not have the above issue, are not consistent across all devices; for example, the Nav bar is deducted on the Nexus 7, but not on the Kindle Fire HD 7 (which, BTW, is one of the devices that has a vertical Nav bar when in landscape orientation).
There are some marginal cases where you might want to know the actual location of the Nav bar, such as when you want to avoid placing a certain commonly-used control near the Nav bar, so that the user does not accidentally hit Back or Home when trying to use it. But generally speaking, this can be avoided (e.g., by placing that control a good distance from the edges of your main view).