Skip to content

MotionActivityEvent

export interface MotionActivityEvent {

Activity recognition result delivered to BackgroundGeolocation.onActivityChange.

The SDK fires this event each time the device's motion-activity classifier detects a change in the current activity type (e.g. from still to on_foot). The event includes both the detected activity and the classifier's confidence level.

BackgroundGeolocation.onActivityChange((event) => {
  console.log("[onActivityChange]", event.activity, event.confidence);
});

Members

activity

activity:MotionActivityType;

Detected motion activity type (e.g. still, on_foot, in_vehicle).

confidence

confidence: number;

Confidence of the detected activity as a percentage (0100).