| java.lang.Object | |
| ↳ | android.hardware.Sensor | 
       Class representing a sensor. Use
       
        
         getSensorList(int)
        
       
       to get
 the list of available Sensors.
      
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| String | STRING_TYPE_ACCELEROMETER | A constant string describing an accelerometer sensor type. | |||||||||
| String | STRING_TYPE_AMBIENT_TEMPERATURE | A constant string describing an ambient temperature sensor type. | |||||||||
| String | STRING_TYPE_GAME_ROTATION_VECTOR | A constant string describing an uncalibrated rotation vector sensor type. | |||||||||
| String | STRING_TYPE_GEOMAGNETIC_ROTATION_VECTOR | A constant string describing a geo-magnetic rotation vector. | |||||||||
| String | STRING_TYPE_GRAVITY | A constant string describing a gravity sensor type. | |||||||||
| String | STRING_TYPE_GYROSCOPE | A constant string describing a gyroscope sensor type. | |||||||||
| String | STRING_TYPE_GYROSCOPE_UNCALIBRATED | A constant string describing an uncalibrated gyroscope sensor type. | |||||||||
| String | STRING_TYPE_HEART_RATE | A constant string describing a heart rate monitor. | |||||||||
| String | STRING_TYPE_LIGHT | A constant string describing a light sensor type. | |||||||||
| String | STRING_TYPE_LINEAR_ACCELERATION | A constant string describing a linear acceleration sensor type. | |||||||||
| String | STRING_TYPE_MAGNETIC_FIELD | A constant string describing a magnetic field sensor type. | |||||||||
| String | STRING_TYPE_MAGNETIC_FIELD_UNCALIBRATED | A constant string describing an uncalibrated magnetic field sensor type. | |||||||||
| String | STRING_TYPE_ORIENTATION | 
         
          This constant was deprecated
      in API level 20.
    use
          
           
            SensorManager.getOrientation()
           
          
          instead.
         
         | 
       |||||||||
| String | STRING_TYPE_PRESSURE | A constant string describing a pressure sensor type. | |||||||||
| String | STRING_TYPE_PROXIMITY | A constant string describing a proximity sensor type. | |||||||||
| String | STRING_TYPE_RELATIVE_HUMIDITY | A constant string describing a relative humidity sensor type | |||||||||
| String | STRING_TYPE_ROTATION_VECTOR | A constant string describing a rotation vector sensor type. | |||||||||
| String | STRING_TYPE_SIGNIFICANT_MOTION | A constant string describing a significant motion trigger sensor. | |||||||||
| String | STRING_TYPE_STEP_COUNTER | A constant string describing a step counter sensor. | |||||||||
| String | STRING_TYPE_STEP_DETECTOR | A constant string describing a step detector sensor. | |||||||||
| String | STRING_TYPE_TEMPERATURE | 
         
          This constant was deprecated
      in API level 20.
    use
          
           
            Sensor.STRING_TYPE_AMBIENT_TEMPERATURE
           
          
          instead.
         
         | 
       |||||||||
| int | TYPE_ACCELEROMETER | A constant describing an accelerometer sensor type. | |||||||||
| int | TYPE_ALL | A constant describing all sensor types. | |||||||||
| int | TYPE_AMBIENT_TEMPERATURE | A constant describing an ambient temperature sensor type. | |||||||||
| int | TYPE_GAME_ROTATION_VECTOR | A constant describing an uncalibrated rotation vector sensor type. | |||||||||
| int | TYPE_GEOMAGNETIC_ROTATION_VECTOR | A constant describing a geo-magnetic rotation vector. | |||||||||
| int | TYPE_GRAVITY | A constant describing a gravity sensor type. | |||||||||
| int | TYPE_GYROSCOPE | A constant describing a gyroscope sensor type. | |||||||||
| int | TYPE_GYROSCOPE_UNCALIBRATED | A constant describing an uncalibrated gyroscope sensor type. | |||||||||
| int | TYPE_HEART_RATE | A constant describing a heart rate monitor. | |||||||||
| int | TYPE_LIGHT | A constant describing a light sensor type. | |||||||||
| int | TYPE_LINEAR_ACCELERATION | A constant describing a linear acceleration sensor type. | |||||||||
| int | TYPE_MAGNETIC_FIELD | A constant describing a magnetic field sensor type. | |||||||||
| int | TYPE_MAGNETIC_FIELD_UNCALIBRATED | A constant describing an uncalibrated magnetic field sensor type. | |||||||||
| int | TYPE_ORIENTATION | 
         
          This constant was deprecated
      in API level 8.
    use
          
           
            SensorManager.getOrientation()
           
          
          instead.
         
         | 
       |||||||||
| int | TYPE_PRESSURE | A constant describing a pressure sensor type. | |||||||||
| int | TYPE_PROXIMITY | A constant describing a proximity sensor type. | |||||||||
| int | TYPE_RELATIVE_HUMIDITY | A constant describing a relative humidity sensor type. | |||||||||
| int | TYPE_ROTATION_VECTOR | A constant describing a rotation vector sensor type. | |||||||||
| int | TYPE_SIGNIFICANT_MOTION | A constant describing a significant motion trigger sensor. | |||||||||
| int | TYPE_STEP_COUNTER | A constant describing a step counter sensor. | |||||||||
| int | TYPE_STEP_DETECTOR | A constant describing a step detector sensor. | |||||||||
| int | TYPE_TEMPERATURE | 
         
          This constant was deprecated
      in API level 14.
    use
          
           
            Sensor.TYPE_AMBIENT_TEMPERATURE
           
          
          instead.
         
         | 
       |||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 
          | 
        
          | 
       ||||||||||
| 
          | 
        
          | 
       ||||||||||
| 
          | 
        
          | 
       ||||||||||
| 
          | 
        
          | 
       ||||||||||
| 
          | 
        
          | 
       ||||||||||
| 
          | 
        
          | 
       ||||||||||
| 
          | 
        
          | 
       ||||||||||
| 
          | 
        
          | 
       ||||||||||
| 
          | 
        
          | 
       ||||||||||
| 
          | 
        
          | 
       ||||||||||
| 
          | 
        
          | 
       ||||||||||
| 
          | 
        
          
          Returns a string containing a concise, human-readable description of this
 object.
          
         | 
       ||||||||||
| 
         
          [Expand]
         
          
          Inherited Methods
          
         | 
       |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
         
           
         
         From class
         
          java.lang.Object
         
          | 
       |||||||||||
A constant string describing an accelerometer sensor type.
A constant string describing an ambient temperature sensor type.
A constant string describing an uncalibrated rotation vector sensor type.
A constant string describing a geo-magnetic rotation vector.
A constant string describing a gravity sensor type.
A constant string describing a gyroscope sensor type.
A constant string describing an uncalibrated gyroscope sensor type.
A constant string describing a heart rate monitor.
A constant string describing a light sensor type.
A constant string describing a linear acceleration sensor type.
A constant string describing a magnetic field sensor type.
A constant string describing an uncalibrated magnetic field sensor type.
        
         This constant was deprecated
      in API level 20.
        
        
        use
        
         
          SensorManager.getOrientation()
         
        
        instead.
       
A constant string describing an orientation sensor type.
A constant string describing a pressure sensor type.
A constant string describing a proximity sensor type.
A constant string describing a relative humidity sensor type
A constant string describing a rotation vector sensor type.
A constant string describing a significant motion trigger sensor.
A constant string describing a step counter sensor.
A constant string describing a step detector sensor.
        
         This constant was deprecated
      in API level 20.
        
        
        use
        
         
          Sensor.STRING_TYPE_AMBIENT_TEMPERATURE
         
        
        instead.
       
A constant string describing a temperature sensor type
A constant describing an accelerometer sensor type.
         See
         
          
           SensorEvent.values
          
         
         for more details.
        
A constant describing all sensor types.
A constant describing an ambient temperature sensor type.
         See
         
          
           SensorEvent.values
          
         
         for more details.
        
A constant describing an uncalibrated rotation vector sensor type.
         Identical to
         
          
           TYPE_ROTATION_VECTOR
          
         
         except that it doesn't
 use the geomagnetic field. Therefore the Y axis doesn't
 point north, but instead to some other reference, that reference is
 allowed to drift by the same order of magnitude as the gyroscope
 drift around the Z axis.
        
In the ideal case, a phone rotated and returning to the same real-world orientation should report the same game rotation vector (without using the earth's geomagnetic field). However, the orientation may drift somewhat over time.
         See
         
          
           SensorEvent.values
          
         
         for more
 details.
        
A constant describing a geo-magnetic rotation vector.
         Similar to
         
          
           TYPE_ROTATION_VECTOR
          
         
         , but using a magnetometer instead of using a
 gyroscope. This sensor uses lower power than the other rotation vectors, because it doesn't
 use the gyroscope. However, it is more noisy and will work best outdoors.
        
         See
         
          
           SensorEvent.values
          
         
         for more details.
        
A constant describing a gravity sensor type.
         See
         
          
           SensorEvent.values
          
         
         for more details.
        
A constant describing a gyroscope sensor type.
         See
         
          
           SensorEvent.values
          
         
         for more details.
        
A constant describing an uncalibrated gyroscope sensor type.
         Similar to
         
          
           TYPE_GYROSCOPE
          
         
         but no gyro-drift compensation has been performed
 to adjust the given sensor values. However, such gyro-drift bias values
 are returned to you separately in the result
         
          
           values
          
         
         so you may use them for custom calibrations.
        
Factory calibration and temperature compensation is still applied to the rate of rotation (angular speeds).
         See
         
          
           SensorEvent.values
          
         
         for more
 details.
        
A constant describing a heart rate monitor.
The reported value is the heart rate in beats per minute.
         The reported accuracy represents the status of the monitor during the reading. See the
         
          SENSOR_STATUS_*
         
         constants in
         
          
           SensorManager
          
         
         for more details on accuracy/status values. In particular, when the accuracy is
         
          SENSOR_STATUS_UNRELIABLE
         
         or
         
          SENSOR_STATUS_NO_CONTACT
         
         , the heart rate
 value should be discarded.
        
         This sensor requires permission
         
          android.permission.BODY_SENSORS
         
         .
 It will not be returned by
         
          SensorManager.getSensorsList
         
         nor
         
          SensorManager.getDefaultSensor
         
         if the application doesn't have this permission.
        
A constant describing a light sensor type.
         See
         
          
           SensorEvent.values
          
         
         for more details.
        
A constant describing a linear acceleration sensor type.
         See
         
          
           SensorEvent.values
          
         
         for more details.
        
A constant describing a magnetic field sensor type.
         See
         
          
           SensorEvent.values
          
         
         for more details.
        
A constant describing an uncalibrated magnetic field sensor type.
         Similar to
         
          
           TYPE_MAGNETIC_FIELD
          
         
         but the hard iron calibration (device calibration
 due to distortions that arise from magnetized iron, steel or permanent magnets on the
 device) is not considered in the given sensor values. However, such hard iron bias values
 are returned to you separately in the result
         
          
           values
          
         
         so you may use them for custom calibrations.
        
Also, no periodic calibration is performed (i.e. there are no discontinuities in the data stream while using this sensor) and assumptions that the magnetic field is due to the Earth's poles is avoided, but factory calibration and temperature compensation have been performed.
         See
         
          
           SensorEvent.values
          
         
         for more
 details.
        
        
         This constant was deprecated
      in API level 8.
        
        
        use
        
         
          SensorManager.getOrientation()
         
        
        instead.
       
A constant describing an orientation sensor type.
         See
         
          
           SensorEvent.values
          
         
         for more details.
        
A constant describing a pressure sensor type.
         See
         
          
           SensorEvent.values
          
         
         for more details.
        
A constant describing a proximity sensor type.
         See
         
          
           SensorEvent.values
          
         
         for more details.
        
A constant describing a relative humidity sensor type.
         See
         
          
           SensorEvent.values
          
         
         for more details.
        
A constant describing a rotation vector sensor type.
         See
         
          
           SensorEvent.values
          
         
         for more details.
        
A constant describing a significant motion trigger sensor.
It triggers when an event occurs and then automatically disables itself. The sensor continues to operate while the device is asleep and will automatically wake the device to notify when significant motion is detected. The application does not need to hold any wake locks for this sensor to trigger.
         See
         
          
           TriggerEvent
          
         
         for more details.
        
A constant describing a step counter sensor.
A sensor of this type returns the number of steps taken by the user since the last reboot while activated. The value is returned as a float (with the fractional part set to zero) and is reset to zero only on a system reboot. The timestamp of the event is set to the time when the first step for that event was taken. This sensor is implemented in hardware and is expected to be low power.
         See
         
          
           SensorEvent.values
          
         
         for more details.
        
A constant describing a step detector sensor.
A sensor of this type triggers an event each time a step is taken by the user. The only allowed value to return is 1.0 and an event is generated for each step. Like with any other event, the timestamp indicates when the event (here the step) occurred, this corresponds to when the foot hit the ground, generating a high variation in acceleration.
         See
         
          
           SensorEvent.values
          
         
         for more details.
        
        
         This constant was deprecated
      in API level 14.
        
        
        use
        
         
          Sensor.TYPE_AMBIENT_TEMPERATURE
         
        
        instead.
       
A constant describing a temperature sensor type
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
          getClass().getName() + '@' + Integer.toHexString(hashCode())
         
        
        
         See
         
          Writing a useful
          
           toString
          
          method
         
         if you intend implementing your own
         
          toString
         
         method.