Skip to content
CARP Docs
Ask AISystemLightDark
On this page

Movesense Plus

A Flutter plugin for Movesense sensors with scanning, connection status, typed sensor streams and raw MDS access.

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

movesense_plus connects Flutter apps to the Movesense MD, Active HR+ and HR2 sensors over Bluetooth Low Energy (BLE). It bundles the Movesense mobile library (MDS) for Android and iOS, so there is no native SDK to set up.

The plugin provides a typed API for scanning, connection status, device information, battery level and sensor streams. Raw MDS requests and subscriptions reach any other resource of the Movesense API. The Mds and MdsAsync classes accept code written for the mdsflutter plugin.

pub.devAPI referenceGitHub

Changes in version 2.0

Version 2.0.0 is the plugin previously published as carp_movesense_flutter. It has a new API and replaces the 1.x releases of movesense_plus, which were built on mdsflutter. To update an app, see Migrate to 2.0.

Features

Scanning and connection

Scan for sensors that advertise the Movesense services, and connect to one from a scan result or by its address. Each MovesenseDevice reports its connection status as a stream.

Device status

When a sensor connects, the plugin reads its model, firmware version and battery state, which is OK or low. Read system states, such as the connection to a strap, on demand.

Typed sensor streams

Heart rate with R-R intervals, ECG, nine-axis inertial measurement unit (IMU) samples and temperature arrive as typed Dart objects. Each stream subscribes on the sensor when you listen and unsubscribes when you cancel.

State events

Get an event each time a system state changes, for example when the user taps the sensor. The sensor allows only one subscription at a time to the motion states: movement, tap, double tap and free fall.

MDS requests

Send GET, PUT, POST and DELETE requests to any resource of the Movesense API, or subscribe to it. Responses and notifications arrive as raw JSON.

mdsflutter compatibility

The static Mds and MdsAsync classes match the mdsflutter API, so most code written for that plugin needs only a new import.

Supported sensors

The plugin supports three Movesense sensors. After a sensor connects, deviceType gives its model as a MovesenseDeviceType value. The plugin derives it from the hardware type, the hw field of the sensor's /Info resource:

SensorDevice typeHardware typeTemperature sensor
Movesense MDmdA1Yes
Movesense Active HR+hrPlusH3Yes
Movesense HR2hr2H4No

For any other hardware type, and while the device information is missing, deviceType is unknown. MovesenseDeviceType also has a flash value for the Movesense FLASH sensor, which the plugin does not detect automatically.

The plugin documents its temperature stream for the Movesense MD only.

Requirements

ComponentRequirement
Dart SDK3.12 or later
Flutter3.44 or later
AndroidAPI level 24 (Android 7.0) or later
iOS15.0 or later
macOSNot supported. The plugin registers, but startScan() and connect() throw a PlatformException, and requests and subscriptions fail with an MdsError.
SensorA Movesense MD, Active HR+ or HR2
TestingA physical phone. The bundled Movesense library has no x86_64 build for Android emulators and no build for the iOS simulator on Apple silicon Macs.

See Installation for the platform setup.

To collect Movesense data in a CARP Mobile Sensing (CAMS) study, see Movesense Sampling Package.

Conflict with carp_movesense_package

carp_movesense_package 3.1.0 depends on carp_movesense_flutter, which bundles the same Movesense library as movesense_plus. With Swift Package Manager, an iOS app with both plugins does not build, so an app that uses carp_movesense_package 3.1.0 must not depend on movesense_plus.

To find sensors in such an app, see Find the sensor.

How it works

The plugin's Dart classes run in your app, and its native code talks to the sensor through MDS:

flowchart LR
    App["<b>Your app</b><br/>Movesense and<br/>MovesenseDevice"] <--> Native["<b>Native plugin code</b><br/>Android and iOS, with<br/>the bundled MDS"]
    Native <-->|BLE| Sensor["<b>Movesense sensor</b><br/>MD, Active HR+ or HR2"]
  • Your app: uses a Movesense client to start scans and send raw MDS requests. A MovesenseDevice for each sensor connects to it and gives its status and typed streams.
  • Native plugin code: runs the BLE scan, filtered to the Movesense services, and passes connections, requests and subscriptions to MDS. The plugin bundles MDS for Android and iOS.
  • Movesense sensor: answers requests and sends notifications for the resources that the app subscribes to.

A connected MovesenseDevice has typed streams for common resources and raw access to the rest:

// Typed: heart rate and R-R intervals from /Meas/HR
device.hr.listen((hr) => print('${hr.average} bpm, R-R ${hr.rrData} ms'));

// Raw: accelerometer at 52 Hz as JSON strings
device.subscribe('/Meas/Acc/52').listen(print);

hr turns each /Meas/HR notification into a MovesenseHR, while subscribe() emits each notification as a JSON string.

Next steps

Installation

Add the plugin and configure Android and iOS for Bluetooth.

Quickstart

Build an app that prints the heart rate from a sensor.

Connecting a device

Scan for sensors, connect to one and follow its status.

Sensor data

Stream heart rate, ECG, IMU and temperature data.

Quick links

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