Time for action – knowing individual sensors' capabilities
Android phones are manufactured by different OEMs, which use different vendors to get their sensors. It is very much possible that two different Android phones have different gyroscope sensors, which will have different ranges and other properties. Before developing a universal logic based on sensors, it's important to keep in mind sensor's individual properties and capabilities, which may vary from device to device. In this section, we will explore the common methods for finding out the properties and capabilities of a sensor:
We will show the sensor properties in the individual
TextView
on the screen. In the following code snippet, theTextView
,Sensor
, andSensorManager
variables are declared:public class SensorCapabilityActivity extends Activity { private SensorManager mSensorManager; private int mSensorType; private Sensor mSensor; private TextView mSensorNameTextView...