Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Fields](https://developer.android.com/reference/android/hardware/TriggerEvent#lfields) \| [Inherited Methods](https://developer.android.com/reference/android/hardware/TriggerEvent#inhmethods)

# TriggerEvent

*** ** * ** ***


`
public

final

class
TriggerEvent
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.hardware.TriggerEvent |

<br />

*** ** * ** ***

This class represents a Trigger Event - the event
associated with a Trigger Sensor. When the sensor detects a trigger
event condition, such as significant motion in the case of the
`https://developer.android.com/reference/android/hardware/Sensor#TYPE_SIGNIFICANT_MOTION`, the `https://developer.android.com/reference/android/hardware/TriggerEventListener`
is called with the TriggerEvent. The sensor is automatically canceled
after the trigger.


This class holds information such as the value of the sensor
when the trigger happened, the timestamp along with detailed
information regarding the Sensor itself.

<br />

**See also:**

- `https://developer.android.com/reference/android/hardware/SensorManager`
- `https://developer.android.com/reference/android/hardware/TriggerEvent`
- `https://developer.android.com/reference/android/hardware/Sensor`

## Summary

| ### Fields ||
|---|---|
| ` public https://developer.android.com/reference/android/hardware/Sensor` | `https://developer.android.com/reference/android/hardware/TriggerEvent#sensor` The sensor that generated this event. |
| ` public long` | `https://developer.android.com/reference/android/hardware/TriggerEvent#timestamp` The time in nanosecond at which the event happened |
| ` public final float[]` | `https://developer.android.com/reference/android/hardware/TriggerEvent#values` <br /> The length and contents of the `https://developer.android.com/reference/android/hardware/TriggerEvent#values` array depends on which `https://developer.android.com/reference/android/hardware/Sensor` type is being monitored (see also `https://developer.android.com/reference/android/hardware/SensorEvent` for a definition of the coordinate system used). |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Fields

### sensor

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Sensor sensor
```

The sensor that generated this event. See
`https://developer.android.com/reference/android/hardware/SensorManager` for details.

<br />

### timestamp

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long timestamp
```

The time in nanosecond at which the event happened

<br />

### values

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public final float[] values
```

<br />


The length and contents of the `https://developer.android.com/reference/android/hardware/TriggerEvent#values` array depends on
which `https://developer.android.com/reference/android/hardware/Sensor` type is being monitored (see
also `https://developer.android.com/reference/android/hardware/SensorEvent` for a definition of the coordinate system used).

#### `https://developer.android.com/reference/android/hardware/Sensor#TYPE_SIGNIFICANT_MOTION`

The value field is of length 1. value\[0\] = 1.0 when the sensor triggers. 1.0 is the only allowed value.

<br />

<br />