Sensor availability
Sensor availability not only varies between different hardware, but also between different Android versions. This is because the introduction of Android sensors requires the release process on several platforms. For example, some sensors are introduced in android1.5 (API level 3), but some are not implemented until android2.3 (API level 9) is available. Similarly, some APIs in android2.3 (API level 9) and android4.0 (API
Level 14) introduced sensors, two of which have been discarded and replaced with newer and better sensors.
Table 2 outlines the availability of each sensor on each basic platform. Only four platforms are listed here, because they are platforms that involve sensor changes. The discarded sensors listed are still valid on subsequent platforms (on devices that provide the sensor). This is Android's backward compatibility policy.
Table 2. Sensor platform availability
Sensor |
Android4.0 (API Level 14) |
Andoroid2.3 (API level 9) |
Android2.2 (API Level 8) |
Android1.5 (API level 3) |
TYPE_ACCELEROMETER
|
Yes |
Yes |
Yes |
Yes |
TYPE_AMBIENT_TEMPERATURE
|
Yes |
N/ |
N/ |
N/ |
TYPE_GRAVITY
|
Yes |
Yes |
N/ |
N/ |
TYPE_GYROSCOPE
|
Yes |
Yes |
N/A1 |
N/A1 |
TYPE_LIGHT
|
Yes |
Yes |
Yes |
Yes |
TYPE_LINEAR_ACCELERATION
|
Yes |
Yes |
N/ |
N/ |
TYPE_MAGNETIC_FIELD
|
Yes |
Yes |
Yes |
Yes |
TYPE_ORIENTATION
|
YES2 |
YES2 |
YES2 |
YES2 |
TYPE_PRESSURE
|
Yes |
Yes |
N/A1 |
N/A1 |
TYPE_PROXIMITY
|
Yes |
Yes |
Yes |
Yes |
TYPE_RELATIVE_HUMIDITY
|
Yes |
N/ |
N/ |
N/ |
TYPE_ROTATION_VECTOR
|
Yes |
Yes |
N/ |
N/ |
TYPE_TEMPERATURE
|
YES2 |
Yes |
Yes |
Yes |
1 This sensor type is available in android1.5 (API
Level3) is added, but it can be used only after android2.3 (API level 9) is known;
2 This sensor is effective, but has been discarded.