Skip to content

Core Wear Detection Overview

Mr.P edited this page Aug 25, 2026 · 2 revisions

Wear Detection Overview

Wear Detection exposes the device's capability, enabled state, and current left/right wear state. Devices that report a configurable capability can also enable or disable detection through the SDK.

Available Features

Browse the generated Wiki navigation for the pages in this section.

Getting Started

  1. Connect to the Device - Wait until the device is connected and ready.
  2. Check Protocol Conformance - Verify support for DeviceWearDetectionAPI.
  3. Read the Capability - Use wearDetectionCapability to determine whether detection is supported and configurable.
  4. Read the Current State - Use isWearDetectionEnabled and wearStatus.
  5. Configure When Supported - Call setWearDetection(enabled:completion:) only for a configurable device.

Key Concepts

Capability

WearDetectionCapability distinguishes three levels:

Value Meaning
.none Wear detection is not supported.
.supportedNotConfigurable Wear detection is supported, but its enabled state cannot be changed through this API.
.supportedAndConfigurable Wear detection is supported and can be enabled or disabled.

State

  • isWearDetectionEnabled reports whether detection is currently enabled.
  • WearStatus reports unknown, not wearing, left-only, right-only, or both-ear state.
  • Capability, enabled state, and wear state are separate values; do not infer one from another.

Protocol Reference

Wear Detection is accessed through DeviceWearDetectionAPI:

Swift

guard let device = device as? DeviceWearDetectionAPI else {
    print("Device does not support DeviceWearDetectionAPI")
    return
}

Objective-C

id<AIBudsDeviceWearDetectionAPI> device =
    (id<AIBudsDeviceWearDetectionAPI>)self.device;
if (![device conformsToProtocol:@protocol(AIBudsDeviceWearDetectionAPI)]) {
    NSLog(@"Device does not support AIBudsDeviceWearDetectionAPI");
    return;
}

Best Practices

  1. Check Capability Before Configuration: Only .supportedAndConfigurable authorizes changing the enabled state.
  2. Use Current Properties: Read the SDK's current snapshots rather than calling invented query methods.
  3. Observe Changes: Use DeviceDelegate callbacks for enabled-state and wear-state changes.
  4. Treat Unknown Explicitly: Keep .unknown distinct from .notWearing.

Notes

  • An enum case existing in the SDK does not guarantee that every device supports that capability.
  • The SDK does not promise automatic playback behavior when wear state changes; application behavior should be based on product requirements.
  • The SDK Demo reads capability and enabled state from DeviceWearDetectionAPI and only presents configuration when the capability is configurable.

AIBuds SDK iOS Wiki

Clone this wiki locally