Class ConnectionMode
This class is not stable, and not subject to any backwards compatibility guarantees or semantic versioning. It is in early access. If you want access to this feature please join the EAP. https://launchdarkly.com/docs/sdk/features/data-saving-mode
Not to be confused with ConnectionInformation.ConnectionMode, which
is the public FDv1 enum representing the SDK's current connection state
(e.g. POLLING, STREAMING, SET_OFFLINE). This class is an internal FDv2
concept describing the desired data-acquisition pipeline.
This is a closed enum — custom connection modes (spec 5.3.5 TBD) are not supported in this release.
The SDK's DataSystemBuilder
allows you to customize which initializers and synchronizers run in each mode.
On mobile, when automatic mode switching is enabled, the SDK resolves a
ConnectionMode from platform state in the same order as
ModeResolutionTable (see DataSystemBuilder.foregroundConnectionMode
and DataSystemBuilder.backgroundConnectionMode).
The default built-in table (ModeResolutionTable.MOBILE) evaluates as follows:
- No network →
OFFLINE - Background with
LDConfig.Builder.disableBackgroundUpdating(boolean)set →OFFLINE - Background (network available, background updates not disabled) →
configured background mode (default
BACKGROUND) - Foreground with network → configured foreground mode (default
STREAMING)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ConnectionModeThe SDK polls at a low frequency while the application is in the background.static final ConnectionModeThe SDK does not make any network requests.static final ConnectionModeThe SDK makes a single poll request and then stops.static final ConnectionModeThe SDK polls for updates at a regular interval.static final ConnectionModeThe SDK uses a streaming connection in the foreground, with polling as a fallback. -
Method Summary
-
Field Details
-
STREAMING
The SDK uses a streaming connection in the foreground, with polling as a fallback. -
POLLING
The SDK polls for updates at a regular interval. -
OFFLINE
The SDK does not make any network requests. It may still serve cached data. -
ONE_SHOT
The SDK makes a single poll request and then stops. -
BACKGROUND
The SDK polls at a low frequency while the application is in the background.
-
-
Method Details