Sensor availability based on the Android API level
There is a wide variety of sensors that are supported on Android devices. As Android evolved over a period of time, new sensors were added, and some old, inefficient sensors were removed. With the release of newer versions of Android, they got better and more accurate, and the list of supported sensors got bigger. Most of the apps have to support older versions of Android to target the wider audience. But at the same time, not all sensors are supported by older versions of Android. It's a tradeoff between supporting older versions of Android versus getting to use the latest and more advanced sensors that are only available in newer versions of Android.
The following table provides the sensor availability list based on the Android version and API levels. This table illustrates four major platforms to show availability, as the major changes were made in these four platforms only:
Sensor |
Android 6.0 (API Level 23) |
Android 4.0 (API Level 14) |
Android 2.3 (API Level 9) |
Android 2.2 (API Level 8) |
Accelerometer |
Available |
Available |
Available |
Available |
Ambient temperature |
Available |
Available |
NA |
NA |
Gravity |
Available |
Available |
Available |
NA |
Gyroscope |
Available |
Available |
Available |
NA |
Light |
Available |
Available |
Available |
Available |
Linear acceleration |
Available |
Available |
Available |
NA |
Magnetic field |
Available |
Available |
Available |
Available |
Orientation |
Deprecated |
Deprecated |
Deprecated |
Deprecated |
Pressure |
Available |
Available |
Available |
NA |
Proximity |
Available |
Available |
Available |
Available |
Relative humidity |
Available |
Available |
NA |
NA |
Rotation vector |
Available |
Available |
Available |
NA |
Step Detector |
Available |
NA |
NA |
NA |
Step Counter |
Available |
NA |
NA |
NA |
Temperature |
Deprecated |
Deprecated |
Available |
Available |