Skip to content

Fall Detection

Creating a Session with Fall Detection Enabled

When creating a PPG Device session the application can instruct the SDK to monitor falling events during the lifetime of that session.

Swift
do {
    let licenseDetails = LicenseDetails(licenseKey: "<ENTER_YOUR_LICENSE_KEY>")
    let deviceID = "<ENTER_POLAR_DEVICE_ID>"
    let session = try PolarSessionBuilder(polarDeviceID: deviceID)
        .withSessionInfoListener(self)
        .withVitalSignsListener(self)
        .withFallDetectionListener(self) 
        .build(licenseDetails: licenseDetails)
}
catch {
    let e = error as NSError
    print("Received Error. Domain: \(e.domain) Code: \(e.code)")
}
Objective-c
BIOLicenseDetails *licenseDetails = [[BIOLicenseDetails alloc] initWithLicenseKey:@"<ENTER_YOUR_LICENSE_KEY>"];
NSString *deviceID = @"<ENTER_POLAR_DEVICE_ID>";
BIOSessionBuilder *sessionBuilder = [[[[[[BIOPolarSessionBuilder alloc] initWithPolarDeviceID:deviceID]
                                       withVitalSignsListener:self]
                                      withSessionInfoListener:self]
                                     withPPGDeviceInfoListener:self]
                                     withFallDetectionListener:self]; 

NSError *error = nil;
id<BIOSession> _Nullable session = [sessionBuilder buildWithLicenseDetails:licenseDetails
                                                                     error:&error];
if (error != nil) {
    NSLog(@"Received Error. Domain: %@ Code: %ld", error.domain, (long)error.code);
}

When such a session is created and transitioned to ready state, falling events are continuously monitored as long as the session is in any of the states ready, starting, processing and stopping. For more information on the session states see the Session State page.

Note

When a session with fall detection is created the fall detection is active also when the SDK is in ready state! On the other hand, vital signs are measured only during the processing state and reported when the state stops and returns to ready state.

A fall event data includes the estimated fall peak time. There might be a delay of up to 5 seconds between the fall itself and the fall notification.

The application can receive indication on a fall event by implementing FallDetectionListener:

Swift
func onFallDetectionData(_ fallDetectionData: FallDetectionData) {
    DispatchQueue.main.async {
        // fallDetectionData.time -      A Date object. The time the fall was detected
    }
}
Objective-c
- (void)onFallDetectionData:(BIOFallDetectionData *)fallDetectionData {
    dispatch_async(dispatch_get_main_queue(), ^{
        // fallDetectionData.time - A Date object. The time the fall was detected
    });
}

License Support for Fall Detection and Error Handling

  • To utilize fall detection within a session, your license must be configured to enable this feature. If your license does not support fall detection, the SDK will return the error licenseFallDetectionDisabledError shortly after the session is created. Please contact our support team to enable the fall detection feature for your license.
  • The error monitoringStoppedError indicates that the SDK stopped monitoring fall detection events during the lifetime of this session due to some error. A new session can be created to work around this temporary issue.
  • Other errors might also happen during the lifetime of a session. It is possible that an error occurs, but the session is still in processing state. In that case the vital signs measurements are still active, but the fall detection is paused for that session until it terminates. A new session can be created to work around this temporary issue.

Note

In the event of unstable communication with the PPG device, the bandwidth between the SDK and the PPG device may be affected. For more information, please refer to the monitoringDataGapExceedsLimitWarning warning in the Alerts List page.

Important

Note that fall events are sent on a background thread. The application must switch to the UI thread in order to perform UI updates.