How to Determine if Android Device has an Accelerometer

public static final String FEATURE_SENSOR_ACCELEROMETER was added in API level 8
Feature for getSystemAvailableFeatures() and hasSystemFeature(String): The device includes an accelerometer.
Constant Value: "android.hardware.sensor.accelerometer"

1. Get a PackageManager Instance named myPackageManager.

2. Create a Boolean Variable named bolAccelSupported

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

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

bolAccelSupported = myPackageManager.hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER);
if (bolAccelSupported) {
Toast.makeText(this, "Device has an Accelerometer", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "Device does NOT have an Accelerometer!", Toast.LENGTH_LONG).show();

5. Compile and run!