How to Determine if Android Device Support Portrait Orientation Screens

public static final String FEATURE_SCREEN_PORTRAIT was added in API level 13
Feature for getSystemAvailableFeatures() and hasSystemFeature(String).
The device supports portrait orientation screens. For backwards compatibility, you can assume that if neither this nor FEATURE_SCREEN_LANDSCAPE is set then the device supports both portrait and landscape.
Constant Value: "android.hardware.screen.portrait"


1. Get a PackageManager Instance named myPackageManager.

2. Create a Boolean Variable named bolPortraitSupported

3. Set the Minimum and Target SDK version  to 13 or greater. 

4. In the onCreate method, add the below code. This will return the portrait ability to a boolean named bolPortraitSupported. It will then display a toast displaying the portrait ability of the device to the user.

bolPortraitSupported = myPackageManager.hasSystemFeature(PackageManager.FEATURE_SCREEN_PORTRAIT);
if (bolPortraitSupported) {
Toast.makeText(this, "Device supports portrait orientation screens", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "Device does NOT support portrait orientation screens!", Toast.LENGTH_LONG).show();
}

5. Compile and run!

Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_SCREEN_PORTRAIT