Check whether a sensor is supported

Here is how you can check whether a sensor of a specific type is supported on a device. In this example we check for an accelerometer.