Skip to content
CARP Docs
Ask AISystemLightDark
On this page

Runtime state

Check whether the watch is paired, collecting and delivering data.

Copy MarkdownOpen inOpen in GitHubView as MarkdownOpen in Scira AIOpen in ChatGPTOpen in ClaudeOpen in Cursor

AppleWatchDeviceManager exposes the state of the watch and of its connection to the phone.

final watchManager =
    DeviceController().getDeviceManager(AppleWatchDevice.DEVICE_TYPE)
        as AppleWatchDeviceManager;

Check that the watch is ready

if (!watchManager.watchStatus.isAvailable) {
  // Tell the participant to install / open the watch app.
}

isAvailable is true when WatchConnectivity is supported, a watch is paired, and the companion watch app is installed on it.

Reachability is not required

isReachable is not part of that check, and should not be. Reachability only matters for live messaging. The operating system queues data files and delivers them when the watch comes back into range, so collection works while the watch is unreachable: in the shower, on a run without the phone, overnight.

AppleWatchStatus

print(watchManager.watchStatus);
watchManager.watchStatusEvents.listen((status) => print(status));
FieldTypeMeaning
isSupportedboolWatchConnectivity is supported (false on Android and on iPads)
isPairedboolA watch is paired with this phone
isWatchAppInstalledboolThe companion watch app is installed on it
isReachableboolThe watch app is reachable right now
isCollectingDataboolThe watch app reported that it is sampling
activationStateStringnotActivated, inactive, or activated
outstandingFileTransferCountintTransfers queued but not yet completed
phoneDeviceIdString?AWARE device id of this phone
watchDeviceIdString?AWARE device id of the watch, once exchanged
lastMessageAtDateTime?Last message exchanged with the watch
lastFileTransferAtDateTime?Last file received from the watch
lastErrorString?Last communication error, if any
isAvailableboolisSupported && isPaired && isWatchAppInstalled

Note

isCollectingData is based on the last status message the watch app sent, so it is only meaningful after the watch app has run at least once. A recently installed watch app that has never been opened reports false.

Interpreting the status

What you seeWhat it meansWhat to tell the participant
isSupported: falseNot an iPhone, or an iPadNothing; the watch is not part of this deployment
isPaired: falseNo watch paired with the phone"Pair your Apple Watch with this iPhone"
isWatchAppInstalled: falseCompanion app missing"Install the study app on your watch from the Watch app"
isCollectingData: falseWatch app installed but not sampling"Open the study app on your watch and press Start"
isReachable: falseOut of range or watch app not in foregroundNothing; this is normal and harmless
outstandingFileTransferCount climbingTransfers queued, phone not receiving themCheck that the phone app is running and the study is deployed

Connection lifecycle

AppleWatchDeviceManager follows the normal CAMS device status model, with these specifics:

BehaviorDetail
canConnecttrue only on iOS
PermissionsNone needed on the phone; the watch asks for its own on the watch
ConnectingConfigures the native sensor, starts listening, and verifies pairing and the companion app
Losing the companion appStatus becomes disconnecting. Recoverable: the participant may reinstall it
Losing the pairingStatus becomes disconnected
DisconnectingStops listening on the phone; the watch keeps collecting and delivers on the next transfer

Watch battery level

print('Watch battery: ${watchManager.batteryLevel}%');
watchManager.batteryEvents.listen((level) => print('Watch at $level%'));

Transfer progress

watchManager.fileTransferEvents.listen((transfer) {
  print('${transfer.chunkIndex}/${transfer.totalChunks} '
        '(${transfer.table}): ${transfer.state.name}');
});

AppleWatchFileTransfer carries table, fileName, chunkIndex, totalChunks, state, and an error message when something failed.

StateMeaning
receivedThe file arrived on the phone
processingBeing decompressed and decoded
decodedRecords decoded and emitted; the normal success state
savingBeing written to the local AWARE database (only with saveToLocalAwareDatabase)
savedWritten to the local AWARE database
failedProcessing failed; see error
saveFailedWriting to the local AWARE database failed
unknownThe native side reported a state this package does not know

Watch information

final info = watchManager.watchInfo;      // AppleWatchDeviceInfo?
print(watchManager.displayName);          // name, model, or 'Apple Watch'

watchInfo is populated once the watch has sent a device record. The same information is carried into the CAMS AppleWatchDeviceRegistration (watchDeviceId, model, systemVersion, and isWatchAppInstalled), so it is stored with the deployment and is available when you analyze the data later.

Quick links

Page · DocumentationCARP DocumentationPage · DocumentationIntroductionPage · DocumentationQuickstartPage · DocumentationTerminologyPage · DocumentationArchitecture