Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public interface SensorSampleListener

Receives measurements and state changes from a SensorSession. All callbacks arrive on the EDT.

Methods

public abstract void sensorSample(SensorSession session, HealthSample sample)A new measurement arrived, already decoded into a health sample in its canonical unit.
public abstract void sensorStateChanged(SensorSession session, SensorSessionState state)The session changed state.
public abstract void sensorError(SensorSession session, HealthException error)An error occurred.

Method details

sensorSample

public abstract void sensorSample(SensorSession session, HealthSample sample)

A new measurement arrived, already decoded into a health sample in its canonical unit.

A single notification can produce more than one sample – a cycling power meter reports power and cadence together – so this is called once per sample, not once per notification.

sensorStateChanged

public abstract void sensorStateChanged(SensorSession session, SensorSessionState state)
The session changed state.

sensorError

public abstract void sensorError(SensorSession session, HealthException error)
An error occurred. The session may still recover if its state is SensorSessionState.RECONNECTING.