ActivitySensor.ReadingChanged ActivitySensor.ReadingChanged ActivitySensor.ReadingChanged ActivitySensor.ReadingChanged ActivitySensor.ReadingChanged Event

Definition

Occurs each time the sensor reports a new sensor reading.

public : event TypedEventHandler<ActivitySensor, ActivitySensorReadingChangedEventArgs> ReadingChanged
// Register
event_token ReadingChanged(TypedEventHandler<ActivitySensor, ActivitySensorReadingChangedEventArgs> const& handler) const;

// Revoke with event_token
void ReadingChanged(event_token const& cookie) const;

// Revoke with event_revoker
ReadingChanged_revoker ReadingChanged(auto_revoke_t, TypedEventHandler<ActivitySensor, ActivitySensorReadingChangedEventArgs> const& handler) const;
public event TypedEventHandler<ActivitySensor, ActivitySensorReadingChangedEventArgs> ReadingChanged
Public Event ReadingChanged As TypedEventHandler (Of ActivitySensor, ActivitySensorReadingChangedEventArgs)
function onReadingChanged(eventArgs){/* Your code */}


activitySensor.addEventListener("readingchanged", onReadingChanged);
activitySensor.removeEventListener("readingchanged", onReadingChanged);

Remarks

When you add a callback function, you receive an initial callback. However, there is a case where you will not receive this initial callback.

  • Add a callback function.
  • Remove the callback function.
  • Add another callback function (or the original one a second time)

In this sequence of events, the second callback function will not receive the initial callback. It will receive callback notifications normally when the ActivitySensor reports a new reading; only the initial callback will be missed.