TechnologiesDevice, Sensors & Hardware

SensorKit

iOSmacOStvOSwatchOSvisionOS

SensorKit collects sensor and usage data from a person's devices for approved research studies, exposing on-device metrics such as motion, ambient light, and speech analysis. You request access to a sensor with an SRSensorReader, respond to its SRSensorReaderDelegate callbacks, and check the resulting SRAuthorizationStatus before fetching recorded data. Submitting an SRFetchRequest returns historical samples through SRFetchResult, including readings like SRAmbientLightSample, SRAccelerometerSensor data, SRWristTemperature, SRSpeechMetrics, and device usage reports such as SRPhoneUsageReport, SRMessagesUsageReport, and SRKeyboardMetrics. Supporting types including SRDevice, SRAbsoluteTime, SRDeletionRecord, and SRError let you identify the source device, work with sample timestamps, and handle data deletion and failures.

Essentials 6

The core objects for requesting sensor access and fetching recorded research data.

  • Cl
    SRSensorReader
    An object that requests authorization for a sensor and reads its recorded research data.
  • Cl
    SRReader
    `SRReader` serves as the primary interface for accessing sensor data from various device sensors.
  • Pr
    SRSensorReaderDelegate
    Methods that respond to authorization changes, fetch progress, and recording state for a sensor reader.
  • En
    SRAuthorizationStatusiOS 14.0+
    Constants that indicate whether a person has granted access to a sensor's data.
  • St
    SRSensoriOS 14.0+
    @typedef SRSensor
  • Pr
    SRDataSensor
    `SRDataSensor` serves as the foundational protocol for all sensor types, providing

Fetching Recorded Samples 4

Types for submitting historical data requests and receiving the resulting samples.

  • Cl
    SRFetchRequestiOS 14.0+
    An object that specifies the device and time range for retrieving recorded sensor samples.
  • Cl
    SRFetchResultiOS 14.0+
    An object that contains a single recorded sample returned from a fetch request.
  • St
    SRFetchResponse
    A generic container that holds sensor data samples retrieved from SensorKit data streams.
  • St
    SRAbsoluteTimeiOS 14.0+
    A type that represents a sample's timestamp on the SensorKit absolute time scale.

Identifying the Source 4

Types that identify the device a sample came from and record data deletions.

  • Cl
    SRDeviceiOS 14.0+
    An object that identifies a device contributing data to a research study.
  • Cl
    SRSourceDeviceiOS 27.0+
    An object that identifies the specific device a recorded sample originated from.
  • Cl
    SRDeletionRecordiOS 14.0+
    An object that describes data a person deleted and the time range it covered.
  • En
    SRDeletionReasoniOS 14.0+
    Constants that indicate why recorded sensor data was deleted.

Motion Sensors 5

Sensors that report device and body motion, including accelerometer, rotation, pedometer, and odometer data.

  • St
    SRAccelerometerSensor
    A sensor that records device acceleration over time.
  • St
    SRRotationRateSensor
    A sensor that records the device's rotation rate over time.
  • St
    SRPedometerDataSensor
    A sensor that records step counts and related pedometer data.
  • St
    SROdometerSensor
    A sensor that records distance traveled over time.
  • St
    SRHeadphoneMotionSensor
    A sensor that records motion data from connected headphones.

Environment Sensors 5

Sensors that capture the ambient conditions around the device.

  • St
    SRAmbientLightSensor
    A sensor that records ambient light readings around the device.
  • Cl
    SRAmbientLightSampleiOS 14.0+
    An object that contains a single ambient light reading and its measurement.
  • St
    SRAmbientPressureSensor
    A sensor that records ambient barometric pressure readings.
  • St
    SRVisitsSensor
    A sensor that records significant location visits over time.
  • Cl
    SRVisitiOS 14.0+
    An object that describes a single significant location visit.

Health and Wrist Sensors 16

Sensors and samples covering heart, temperature, sleep, and wrist-detection signals.

  • St
    SRHeartRateSensor
    A sensor that records heart rate measurements.
  • St
    SRElectrocardiogramSensor
    A sensor that records electrocardiogram (ECG) data.
  • Cl
    SRElectrocardiogramSessioniOS 17.4+
    An object that describes a single electrocardiogram recording session.
  • Cl
    SRElectrocardiogramDataiOS 17.4+
    An object that contains the data captured during an electrocardiogram session.
  • Cl
    SRElectrocardiogramSampleiOS 17.4+
    An object that contains a single electrocardiogram measurement.
  • St
    SRPhotoplethysmogramSensor
    A sensor that records photoplethysmogram (PPG) optical blood-flow data.
  • Cl
    SRPhotoplethysmogramSampleiOS 17.4+
    An object that contains a single photoplethysmogram measurement.
  • Cl
    SRPhotoplethysmogramOpticalSampleiOS 17.4+
    @class SRPhotoplethysmogramOpticalSample
  • Cl
    SRPhotoplethysmogramAccelerometerSampleiOS 17.4+
    An object that contains accelerometer data accompanying a photoplethysmogram sample.
  • St
    SRWristTemperatureSensor
    A sensor that records wrist temperature measurements.
  • Cl
    SRWristTemperatureiOS 17.0+
    An object that contains a single wrist temperature reading.
  • Cl
    SRWristTemperatureSessioniOS 17.0+
    An object that describes a session of wrist temperature recordings.
  • Cl
    SRWristDetectioniOS 14.0+
    An object that reports whether the device is being worn on the wrist.
  • St
    SROnWristStateSensor
    A sensor that records whether a worn device is on the wrist.
  • St
    SRSleepSessionsSensor
    A sensor that records detected sleep sessions.
  • Cl
    SRSleepSessioniOS 26.0+
    An object that describes a single detected sleep session.

Audio and Speech Sensors 9

Sensors that analyze speech, audio levels, and headphone acoustic settings.

  • St
    SRSiriSpeechMetricsSensor
    A sensor that records on-device speech metrics from Siri interactions.
  • St
    SRTelephonySpeechMetricsSensor
    A sensor that records on-device speech metrics from telephony calls.
  • Cl
    SRSpeechMetricsiOS 17.0+
    An object that contains on-device measurements derived from a person's speech.
  • Cl
    SRSpeechExpressioniOS 17.0+
    An object that describes expressive characteristics detected in speech.
  • Cl
    SRAudioLeveliOS 17.0+
    An object that describes a measured audio level.
  • St
    SRAcousticSettingsSensor
    A sensor that records the device's acoustic configuration settings.
  • Cl
    SRAcousticSettingsiOS 26.0+
    An object that describes acoustic settings in effect on the device.
  • St
    SRHeadphoneSettingsSensor
    A sensor that records connected headphone configuration settings.
  • Cl
    SRHeadphoneSettingsiOS 27.0+
    An object that describes the settings of connected headphones.

Face Sensors 3

Sensors and samples that capture facial expression metrics.

  • St
    SRFaceMetricsSensor
    A sensor that records facial expression metrics.
  • Cl
    SRFaceMetricsiOS 17.0+
    An object that contains measured facial expression metrics.
  • Cl
    SRFaceMetricsExpressioniOS 17.0+
    An object that describes a single facial expression detected in face metrics.

Device Usage Reports 13

Sensors and reports describing how a person uses their phone, messages, keyboard, and media.

  • St
    SRDeviceUsageSensor
    A sensor that records general device usage activity.
  • Cl
    SRDeviceUsageReportiOS 14.0+
    An object that summarizes how a person used their device over a period.
  • St
    SRPhoneUsageSensor
    A sensor that records phone call usage activity.
  • Cl
    SRPhoneUsageReportiOS 14.0+
    An object that summarizes a person's phone call usage over a period.
  • St
    SRMessagesUsageSensor
    A sensor that records Messages app usage activity.
  • Cl
    SRMessagesUsageReportiOS 14.0+
    An object that summarizes a person's Messages usage over a period.
  • St
    SRKeyboardMetricsSensor
    A sensor that records on-device keyboard typing metrics.
  • Cl
    SRKeyboardMetricsiOS 14.0+
    An object that contains measured keyboard typing metrics.
  • St
    SRMediaEventsSensor
    A sensor that records media interaction events.
  • Cl
    SRMediaEventiOS 16.4+
    An object that describes a single media interaction event.
  • En
    SRMediaEventTypeiOS 16.4+
    Constants that classify the kind of a recorded media event.
  • Cl
    SRTextInputSessioniOS 15.0+
    An object that describes a session of text input captured for keyboard metrics.
  • Cl
    SRSupplementalCategoryiOS 16.4+
    @class SRSupplementalCategory

Errors 1

The error type that describes SensorKit access and fetch failures.

  • St
    SRErroriOS 14.0+
    A structure that describes errors raised while requesting access to or fetching SensorKit data.

Extends 2

NSDateNSString
← Device, Sensors & Hardware