Check what sensors we have available

Before I start using the sensors of a device, I would like to know which ones are available at all. First, I glue the TextView component on the screen to display the results:

 

On the main activity onCreate method, I add a couple lines of code. The code that is to execute the task is in this method because I want the results to be displayed immediately after the program starts. Lines 21.22 is a reference to the TextView component and the contents of the text (clean) are cleared. The SensorManager class I refer to in line 25 (the object declaration itself is in line 14) gives us access to the sensors built into the device. Get an instance of this class by calling the getSystemService method with the SENSOR_SERVICE parameter. To read the sensor names that are available on the device, I use the SensorManager getSensorList (line 26) method. This method returns the available (ie, the devices on the device) the type of sensors indicated. Here I enter as type Sensor.TYPE_ALL, Thanks to that I get all types of sensors. I could insert in this place eg Sensor.TYPE_GYROSCOPE and I would get a list of all available gyros in the device. Lines 27-29 are iterations on the returned objects and adding consecutive lines with the names of subsequent sensors to the text compiler.

Effect on Samsung ACE3: