Android Get sensor list

Source: Internet
Author: User

This article describes how to obtain a list of sensors supported by your Android device.


Currently, Android 4.4 (API level 19) supports the following sensors:

Type_accelerometer Accelerometer, Unit m/s2, measurement of the accelerometer type values (sensors type) applied to the device x, Y, Z axes: 1 (0x00000001) Type_ambient_ Temperature temperature sensor, Unit is ℃ sensor type value (sensors type): (0x0000000d) Type_game_rotation_vector game action sensor, no electromagnetic interference affects the sensor type value Type): (0x0000000f) type_geomagnetic_rotation_vector geomagnetic rotation vector sensor that provides the rotation vector of the phone, while the phone is in hibernation, you can still record the device's azimuth sensor type value (sensor Type): (0x00000014) type_gravity gravity sensor, Unit m/s2, measurement of gravity sensor type value (sensor type) applied to device X, Y, Z axis: 9 (0x00000009) type_ GYROSCOPE Gyroscope sensor, Unit is RAD/S, measurement equipment x, Y, z three-axis angular acceleration sensor type value (sensor type): 4 (0x00000004) type_gyroscope_uncalibrated not calibrated gyro sensor, Provides raw, non-calibrated, compensated gyroscope data for post-processing and fusion positioning data sensor type values (sensors type): 0x00000010 type_light light sensor, unit LX, detects ambient light intensity sensor type values Type): 5 (0x00000005) type_linear_acceleration linear accelerometer, unit M/S2, the sensor is the data sensor type value obtained by the acceleration sensor to remove the gravitational force (sensor type): 10 ( 0x0000000a) Type_magnetic_field Magnetic sensor, Unit is UT (micro-tesla), measuring equipment around three physical axes (x, y, z) of the magnetic field sensor type value (sensor type): 2 (0x00000002) type_ The magnetic_field_uncalibrated magnetic sensor is not calibrated to provide a raw, non-calibrated magnetic field data sensor type value (sensor type): (0x0000000e) type_orientation direction sensor, Measuring device rotation angle sensor type values around three physical axes (x, y, z)(sensor type): 3 (0x00000003) type_pressure pressure sensor, Unit is HPA (kpa), returns the pressure sensor type value in the current environment (sensor type): 6 (0x00000006) type_ The proximity distance sensor, in cm, is used to measure the distance of an object to the screen. Sensor Type value: 8 (0x00000008) type_relative_humidity humidity sensor, unit is%, To measure the relative humidity sensor type value of the surrounding environment: (0x0000000c) type_rotation_vector rotation vector sensor, rotation vector represents the direction sensor type value of the device (sensor types): 11 ( 0X0000000B) Type_significant_motion Special Action trigger sensor sensor type value (sensor types): (0x00000011) Type_step_ Counter Step sensor sensor type value (sensors type): (0x00000013) Type_step_detector Walk detection sensor, the user triggers the event sensor type value each step of the way: 18 ( 0x00000012) Type_temperature temperature sensor, currently type_ambient_temperature replacement sensor type value (sensor type): 7 (0x00000007)

The code to get the sensor list is as follows:

Package Com.example.androidtest;import Java.util.list;import Android.os.bundle;import Android.annotation.suppresslint;import Android.app.activity;import Android.content.context;import Android.hardware.sensor;import Android.hardware.sensormanager;import Android.view.menu;public class MainActivity Extends Activity {@Overrideprotected void onCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_main); Getsensorlist ();} @SuppressLint ("Newapi") private void Getsensorlist () {//Get sensor manager Sensormanager Sensormanager = (Sensormanager) Getsystemservice (Context.sensor_service);//Get the full list of sensors list<sensor> sensors = sensormanager.getsensorlist ( Sensor.type_all)///print each sensor information StringBuilder Strlog = new StringBuilder (); int iIndex = 1;for (sensor item:sensors) {Strlog . Append (IIndex + "."); Strlog.append ("Sensor Type-" + item.gettype () + "\ r \ n"), Strlog.append ("Sensor Name-" + item.getname () + "\ r \ n"); Strlog . Append ("Sensor Version-" + item.getversion () + "\ r \ n"), Strlog.append ("Sensor Vendor-" + item.getvendor () + "\ r \ n"); Strlog.append ("Maximum Range-" + Item.getmaximu Mrange () + "\ r \ n"), Strlog.append ("Minimum Delay-" + item.getmindelay () + "\ r \ n"); Strlog.append ("Power-" + Item.getpowe R () + "\ r \ n"), Strlog.append ("Resolution-" + item.getresolution () + "\ r \ n"); Strlog.append ("\ r \ n"); iindex++;} System.out.println (Strlog.tostring ());} @Overridepublic boolean Oncreateoptionsmenu (Menu menu) {//Inflate the menu; This adds items to the action bar if it is PR Esent.getmenuinflater (). Inflate (R.menu.activity_main, menu); return true;}}

In the case of Samsung Note3, the following sensors are supported:

1.Sensor type-1sensor name-mpu6500 Acceleration sensorsensor version-1sensor vendor-invensensemaximum Range-19.6 133Minimum delay-5000power-0.25resolution-5.985504e-42. Sensor type-2sensor name-yas532 Magnetic sensorsensor version-1sensor Vendor-yamaha corporationmaximum Range-120 0.0Minimum delay-10000power-6.0resolution-0.063.sensor type-14sensor name-yas532 uncalibrated Magnetic SensorSen Sor version-1sensor vendor-yamaha corporationmaximum range-1200.0minimum delay-10000power-6.0resolution-0.064. Sensor type-4sensor name-mpu6500 Gyroscope sensorsensor version-1sensor vendor-invensensemaximum range-8.726646m Inimum delay-5000power-6.1resolution-2.663161e-45.  Sensor type-6sensor name-barometer sensorsensor version-1sensor vendor-boschmaximum range-1013.25minimum Delay-  66700power-1.0resolution-1.06.sensor type-8sensor name-max88921 Proximity sensorsensor version-1sensor Vendor- MAXIM, Inc.maximum Range-8.0Minimum delay-0power-0.75resolution-8.07.sensor type-5sensor name-max88921 RGB sensorsensor version-1sensor  Vendor-maxim, Inc.maximum range-60000.0minimum delay-200000power-0.75resolution-1.08.sensor type-12sensor Name -SHTC1 Relative humidity sensorsensor version-1sensor vendor-sensirionmaximum range-100.0minimum delay-1000000po Wer-0.3resolution-0.049.sensor type-13sensor name-shtc1 Ambient temperature sensorsensor version-1sensor Vendor -Sensirionmaximum range-165.0minimum delay-1000000power-0.3resolution-0.0110.sensor type-15sensor Name-mpl Ga Me Rotation vectorsensor version-1sensor vendor-invensensemaximum range-1200.0minimum Delay-10000power-6.0resolu Tion-0.0611.sensor type-18sensor Name-samsung Step Detector sensorsensor version-1sensor Vendor-samsung Inc.Maxi Mum Range-1.0minimum delay-0power-0.3resolution-1.012.sensor type-19sensor Name-samsung Step Counter SensorSen Sor version-1sensor VeNdor-samsung inc.maximum range-100000.0minimum delay-0power-0.3resolution-1.013.sensor type-17sensor Name-sa  Msung significant Motion sensorsensor version-1sensor Vendor-samsung inc.maximum range-1.0minimum delay-10000power -0.3resolution-1.014.sensor type-16sensor name-mpu6500 uncalibrated Gyroscope sensorsensor version-1sensor Vendo R-invensensemaximum range-8.726646minimum delay-5000power-6.1resolution-2.663161e-415. Sensor type-65558sensor name-auto Rotation sensorsensor version-1sensor Vendor-samsung electronicsmaximum Range- 255.0Minimum delay-0power-0.0resolution-0.016.sensor type-11sensor name-rotation Vector sensorsensor Version-3 Sensor vendor-aospmaximum range-1.0minimum delay-5000power-12.35resolution-5.9604645e-817. Sensor type-9sensor name-gravity sensorsensor version-3sensor vendor-aospmaximum range-19.6133minimum Delay-50 00power-12.35resolution-5.985504e-418. Sensor Type-10sensor Name-Linear acceleration sensorsensor version-3sensor vendor-aospmaximum range-19.6133minimum delay-5000power-12.35re solution-5.985504e-419. Sensor type-3sensor name-orientation sensorsensor version-1sensor vendor-aospmaximum range-360.0minimum Delay- 5000power-12.35resolution-0.00390625


Android Get sensor list

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.