Fields Summary |
---|
public static final int | TYPE_ACCELEROMETERA constant describing an accelerometer sensor type.
See {@link android.hardware.SensorEvent#values SensorEvent.values}
for more details. |
public static final String | STRING_TYPE_ACCELEROMETERA constant string describing an accelerometer sensor type. |
public static final int | TYPE_MAGNETIC_FIELDA constant describing a magnetic field sensor type.
See {@link android.hardware.SensorEvent#values SensorEvent.values}
for more details. |
public static final String | STRING_TYPE_MAGNETIC_FIELDA constant string describing a magnetic field sensor type. |
public static final int | TYPE_ORIENTATIONA constant describing an orientation sensor type.
See {@link android.hardware.SensorEvent#values SensorEvent.values}
for more details. |
public static final String | STRING_TYPE_ORIENTATIONA constant string describing an orientation sensor type. |
public static final int | TYPE_GYROSCOPEA constant describing a gyroscope sensor type.
See {@link android.hardware.SensorEvent#values SensorEvent.values}
for more details. |
public static final String | STRING_TYPE_GYROSCOPEA constant string describing a gyroscope sensor type. |
public static final int | TYPE_LIGHTA constant describing a light sensor type.
See {@link android.hardware.SensorEvent#values SensorEvent.values}
for more details. |
public static final String | STRING_TYPE_LIGHTA constant string describing a light sensor type. |
public static final int | TYPE_PRESSUREA constant describing a pressure sensor type.
See {@link android.hardware.SensorEvent#values SensorEvent.values}
for more details. |
public static final String | STRING_TYPE_PRESSUREA constant string describing a pressure sensor type. |
public static final int | TYPE_TEMPERATUREA constant describing a temperature sensor type |
public static final String | STRING_TYPE_TEMPERATUREA constant string describing a temperature sensor type |
public static final int | TYPE_PROXIMITYA constant describing a proximity sensor type. This is a wake up sensor.
See {@link android.hardware.SensorEvent#values SensorEvent.values}
for more details. |
public static final String | STRING_TYPE_PROXIMITYA constant string describing a proximity sensor type. |
public static final int | TYPE_GRAVITYA constant describing a gravity sensor type.
See {@link android.hardware.SensorEvent#values SensorEvent.values}
for more details. |
public static final String | STRING_TYPE_GRAVITYA constant string describing a gravity sensor type. |
public static final int | TYPE_LINEAR_ACCELERATIONA constant describing a linear acceleration sensor type.
See {@link android.hardware.SensorEvent#values SensorEvent.values}
for more details. |
public static final String | STRING_TYPE_LINEAR_ACCELERATIONA constant string describing a linear acceleration sensor type. |
public static final int | TYPE_ROTATION_VECTORA constant describing a rotation vector sensor type.
See {@link android.hardware.SensorEvent#values SensorEvent.values}
for more details. |
public static final String | STRING_TYPE_ROTATION_VECTORA constant string describing a rotation vector sensor type. |
public static final int | TYPE_RELATIVE_HUMIDITYA constant describing a relative humidity sensor type.
See {@link android.hardware.SensorEvent#values SensorEvent.values}
for more details. |
public static final String | STRING_TYPE_RELATIVE_HUMIDITYA constant string describing a relative humidity sensor type |
public static final int | TYPE_AMBIENT_TEMPERATUREA constant describing an ambient temperature sensor type.
See {@link android.hardware.SensorEvent#values SensorEvent.values}
for more details. |
public static final String | STRING_TYPE_AMBIENT_TEMPERATUREA constant string describing an ambient temperature sensor type. |
public static final int | TYPE_MAGNETIC_FIELD_UNCALIBRATEDA constant describing an uncalibrated magnetic field sensor type.
Similar to {@link #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 {@link android.hardware.SensorEvent#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 {@link android.hardware.SensorEvent#values SensorEvent.values} for more
details. |
public static final String | STRING_TYPE_MAGNETIC_FIELD_UNCALIBRATEDA constant string describing an uncalibrated magnetic field sensor type. |
public static final int | TYPE_GAME_ROTATION_VECTORA constant describing an uncalibrated rotation vector sensor type.
Identical to {@link #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 {@link android.hardware.SensorEvent#values SensorEvent.values} for more
details. |
public static final String | STRING_TYPE_GAME_ROTATION_VECTORA constant string describing an uncalibrated rotation vector sensor type. |
public static final int | TYPE_GYROSCOPE_UNCALIBRATEDA constant describing an uncalibrated gyroscope sensor type.
Similar to {@link #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 {@link android.hardware.SensorEvent#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 {@link android.hardware.SensorEvent#values SensorEvent.values} for more
details. |
public static final String | STRING_TYPE_GYROSCOPE_UNCALIBRATEDA constant string describing an uncalibrated gyroscope sensor type. |
public static final int | TYPE_SIGNIFICANT_MOTIONA 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. This is a wake up sensor.
See {@link TriggerEvent} for more details. |
public static final String | STRING_TYPE_SIGNIFICANT_MOTIONA constant string describing a significant motion trigger sensor. |
public static final int | TYPE_STEP_DETECTORA 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. This sensor is
only for detecting every individual step as soon as it is taken, for example to perform dead
reckoning. If you only need aggregate number of steps taken over a period of time, register
for {@link #TYPE_STEP_COUNTER} instead. It is defined as a
{@link Sensor#REPORTING_MODE_SPECIAL_TRIGGER} sensor.
See {@link android.hardware.SensorEvent#values SensorEvent.values} for more details. |
public static final String | STRING_TYPE_STEP_DETECTORA constant string describing a step detector sensor. |
public static final int | TYPE_STEP_COUNTERA 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 last step for that event was taken. This sensor is implemented in hardware and is
expected to be low power. If you want to continuously track the number of steps over a long
period of time, do NOT unregister for this sensor, so that it keeps counting steps in the
background even when the AP is in suspend mode and report the aggregate count when the AP
is awake. Application needs to stay registered for this sensor because step counter does not
count steps if it is not activated. This sensor is ideal for fitness tracking applications.
It is defined as an {@link Sensor#REPORTING_MODE_ON_CHANGE} sensor.
See {@link android.hardware.SensorEvent#values SensorEvent.values} for more details. |
public static final String | STRING_TYPE_STEP_COUNTERA constant string describing a step counter sensor. |
public static final int | TYPE_GEOMAGNETIC_ROTATION_VECTORA constant describing a geo-magnetic rotation vector.
Similar to {@link #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 {@link android.hardware.SensorEvent#values SensorEvent.values} for more details. |
public static final String | STRING_TYPE_GEOMAGNETIC_ROTATION_VECTORA constant string describing a geo-magnetic rotation vector. |
public static final int | TYPE_HEART_RATEA 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
{@code SENSOR_STATUS_*} constants in {@link android.hardware.SensorManager SensorManager}
for more details on accuracy/status values. In particular, when the accuracy is
{@code SENSOR_STATUS_UNRELIABLE} or {@code SENSOR_STATUS_NO_CONTACT}, the heart rate
value should be discarded.
This sensor requires permission {@code android.permission.BODY_SENSORS}.
It will not be returned by {@code SensorManager.getSensorsList} nor
{@code SensorManager.getDefaultSensor} if the application doesn't have this permission. |
public static final String | STRING_TYPE_HEART_RATEA constant string describing a heart rate monitor. |
public static final int | TYPE_TILT_DETECTORA sensor of this type generates an event each time a tilt event is detected. A tilt event
is generated if the direction of the 2-seconds window average gravity changed by at
least 35 degrees since the activation of the sensor. It is a wake up sensor. |
public static final String | SENSOR_STRING_TYPE_TILT_DETECTORA constant string describing a wake up tilt detector sensor type. |
public static final int | TYPE_WAKE_GESTUREA constant describing a wake gesture sensor.
Wake gesture sensors enable waking up the device based on a device specific motion.
When this sensor triggers, the device behaves as if the power button was pressed, turning the
screen on. This behavior (turning on the screen when this sensor triggers) might be
deactivated by the user in the device settings. Changes in settings do not impact the
behavior of the sensor: only whether the framework turns the screen on when it triggers.
The actual gesture to be detected is not specified, and can be chosen by the manufacturer of
the device. This sensor must be low power, as it is likely to be activated 24/7.
Values of events created by this sensors should not be used. |
public static final String | STRING_TYPE_WAKE_GESTUREA constant string describing a wake gesture sensor. |
public static final int | TYPE_GLANCE_GESTUREA constant describing a wake gesture sensor.
A sensor enabling briefly turning the screen on to enable the user to
glance content on screen based on a specific motion. The device should
turn the screen off after a few moments.
When this sensor triggers, the device turns the screen on momentarily
to allow the user to glance notifications or other content while the
device remains locked in a non-interactive state (dozing). This behavior
(briefly turning on the screen when this sensor triggers) might be deactivated
by the user in the device settings. Changes in settings do not impact the
behavior of the sensor: only whether the framework briefly turns the screen on
when it triggers.
The actual gesture to be detected is not specified, and can be chosen by the manufacturer of
the device. This sensor must be low power, as it is likely to be activated 24/7.
Values of events created by this sensors should not be used. |
public static final String | STRING_TYPE_GLANCE_GESTUREA constant string describing a wake gesture sensor. |
public static final int | TYPE_PICK_UP_GESTUREA constant describing a pick up sensor.
A sensor of this type triggers when the device is picked up regardless of wherever it was
before (desk, pocket, bag). The only allowed return value is 1.0. This sensor deactivates
itself immediately after it triggers. |
public static final String | STRING_TYPE_PICK_UP_GESTUREA constant string describing a pick up sensor. |
public static final int | TYPE_ALLA constant describing all sensor types. |
private static final int | SENSOR_FLAG_WAKE_UP_SENSOR |
public static final int | REPORTING_MODE_CONTINUOUSEvents are reported at a constant rate which is set by the rate parameter of
{@link SensorManager#registerListener(SensorEventListener, Sensor, int)}. Note: If other
applications are requesting a higher rate, the sensor data might be delivered at faster rates
than requested. |
public static final int | REPORTING_MODE_ON_CHANGEEvents are reported only when the value changes. Event delivery rate can be limited by
setting appropriate value for rate parameter of
{@link SensorManager#registerListener(SensorEventListener, Sensor, int)} Note: If other
applications are requesting a higher rate, the sensor data might be delivered at faster rates
than requested. |
public static final int | REPORTING_MODE_ONE_SHOTEvents are reported in one-shot mode. Upon detection of an event, the sensor deactivates
itself and then sends a single event. Sensors of this reporting mode must be registered to
using {@link SensorManager#requestTriggerSensor(TriggerEventListener, Sensor)}. |
public static final int | REPORTING_MODE_SPECIAL_TRIGGEREvents are reported as described in the description of the sensor. The rate passed to
registerListener might not have an impact on the rate of event delivery. See the sensor
definition for more information on when and how frequently the events are reported. For
example, step detectors report events when a step is detected. |
private static final int | REPORTING_MODE_MASK |
private static final int | REPORTING_MODE_SHIFT |
private static final int[] | sSensorReportingModes |
private String | mName |
private String | mVendor |
private int | mVersion |
private int | mHandle |
private int | mType |
private float | mMaxRange |
private float | mResolution |
private float | mPower |
private int | mMinDelay |
private int | mFifoReservedEventCount |
private int | mFifoMaxEventCount |
private String | mStringType |
private String | mRequiredPermission |
private int | mMaxDelay |
private int | mFlags |
Methods Summary |
---|
public int | getFifoMaxEventCount()
return mFifoMaxEventCount;
|
public int | getFifoReservedEventCount()
return mFifoReservedEventCount;
|
public int | getHandle()
return mHandle;
|
public int | getMaxDelay()This value is defined only for continuous and on-change sensors. It is the delay between two
sensor events corresponding to the lowest frequency that this sensor supports. When lower
frequencies are requested through registerListener() the events will be generated at this
frequency instead. It can be used to estimate when the batch FIFO may be full. Older devices
may set this value to zero. Ignore this value in case it is negative or zero.
return mMaxDelay;
|
static int | getMaxLengthValuesArray(android.hardware.Sensor sensor, int sdkLevel)
// RotationVector length has changed to 3 to 5 for API level 18
// Set it to 3 for backward compatibility.
if (sensor.mType == Sensor.TYPE_ROTATION_VECTOR &&
sdkLevel <= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return 3;
}
int offset = sensor.mType;
if (offset >= sSensorReportingModes.length) {
// we don't know about this sensor, so this is probably a
// vendor-defined sensor, in that case, we don't know how many value
// it has
// so we return the maximum and assume the app will know.
// FIXME: sensor HAL should advertise how much data is returned per
// sensor
return 16;
}
return sSensorReportingModes[offset];
|
public float | getMaximumRange()
return mMaxRange;
|
public int | getMinDelay()
return mMinDelay;
|
public java.lang.String | getName()
return mName;
|
public float | getPower()
return mPower;
|
public int | getReportingMode()Each sensor has exactly one reporting mode associated with it. This method returns the
reporting mode constant for this sensor type.
return ((mFlags & REPORTING_MODE_MASK) >> REPORTING_MODE_SHIFT);
|
public java.lang.String | getRequiredPermission()
return mRequiredPermission;
|
public float | getResolution()
return mResolution;
|
public java.lang.String | getStringType()
return mStringType;
|
public int | getType()
return mType;
|
public java.lang.String | getVendor()
return mVendor;
|
public int | getVersion()
return mVersion;
|
public boolean | isWakeUpSensor()Returns true if the sensor is a wake-up sensor.
Application Processor Power modes
Application Processor(AP), is the processor on which applications run. When no wake lock is held
and the user is not interacting with the device, this processor can enter a â |