Share via


SensorManager.CancelTriggerSensor(TriggerEventListener, Sensor) Method

Definition

Cancels receiving trigger events for a trigger sensor.

[Android.Runtime.Register("cancelTriggerSensor", "(Landroid/hardware/TriggerEventListener;Landroid/hardware/Sensor;)Z", "GetCancelTriggerSensor_Landroid_hardware_TriggerEventListener_Landroid_hardware_Sensor_Handler")]
public virtual bool CancelTriggerSensor (Android.Hardware.TriggerEventListener? listener, Android.Hardware.Sensor? sensor);
[<Android.Runtime.Register("cancelTriggerSensor", "(Landroid/hardware/TriggerEventListener;Landroid/hardware/Sensor;)Z", "GetCancelTriggerSensor_Landroid_hardware_TriggerEventListener_Landroid_hardware_Sensor_Handler")>]
abstract member CancelTriggerSensor : Android.Hardware.TriggerEventListener * Android.Hardware.Sensor -> bool
override this.CancelTriggerSensor : Android.Hardware.TriggerEventListener * Android.Hardware.Sensor -> bool

Parameters

listener
TriggerEventListener

The listener on which the TriggerEventListener#onTrigger(TriggerEvent) is delivered.It should be the same as the one used in #requestTriggerSensor(TriggerEventListener, Sensor)

sensor
Sensor

The sensor for which the trigger request should be canceled. If null, it cancels receiving trigger for all sensors associated with the listener.

Returns

true if successfully canceled.

Attributes

Exceptions

when sensor is a trigger sensor.

Remarks

Cancels receiving trigger events for a trigger sensor.

Note that a Trigger sensor will be auto disabled if TriggerEventListener#onTrigger(TriggerEvent) has triggered. This method is provided in case the user wants to explicitly cancel the request to receive trigger events.

Java documentation for android.hardware.SensorManager.cancelTriggerSensor(android.hardware.TriggerEventListener, android.hardware.Sensor).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to