Skip to Content
Video measurementLocal Memory

Overview

The On-Device Memory feature automatically stores video measurements results locally on the device, enabling historical analysis and trend tracking. Measurement results are stored separately for each user ID provided during initialization.

Disabling local memory

Local memory is enabled by default. Disable it before initialization when the SDK should not read locally persisted state on startup. When disabled, the SDK skips local reads and writes for persisted SDK state. Disabling local memory through initialization settings deletes the stored local profile for the initialized user ID and prevents the SDK from loading old history for that session. If no userId is provided during the initialization, the SDK uses the default local profile, so clearing the memory affects that default profile.

When local memory is disabled, history-backed UI features cannot use persisted state. The SDK automatically forces enableMeasurementsDashboard and saveHealthRisksFactors to false, including values supplied through Remote Configuration during that session.

final settings = InitializationSettings(localMemoryEnabled: false); await ShenaiSdk.initialize(apiKey, userId, settings: settings);

Accessing the history

Call getMeasurementResultsHistory() to retrieve measurements results history from local memory. If no measurement has finished successfully yet, a null value will be returned. Below is a summary of the returned structure:

class MeasurementResultsWithMetadata { MeasurementResults measurementResults; int epochTimestamp; bool isCalibration; } class MeasurementResultsHistory { List<MeasurementResultsWithMetadata?> history; } final history = await ShenaiSdk.getMeasurementResultsHistory();