Class ConnectionMode

java.lang.Object
com.launchdarkly.sdk.android.ConnectionMode

public final class ConnectionMode extends Object
Enumerates the built-in FDv2 connection modes. Each mode maps to a pipeline of initializers and synchronizers that are active when the SDK is operating in that mode.

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:

  1. No network → OFFLINE
  2. Background with LDConfig.Builder.disableBackgroundUpdating(boolean) set → OFFLINE
  3. Background (network available, background updates not disabled) → configured background mode (default BACKGROUND)
  4. Foreground with network → configured foreground mode (default STREAMING)
See Also:
  • Field Details

    • STREAMING

      public static final ConnectionMode STREAMING
      The SDK uses a streaming connection in the foreground, with polling as a fallback.
    • POLLING

      public static final ConnectionMode POLLING
      The SDK polls for updates at a regular interval.
    • OFFLINE

      public static final ConnectionMode OFFLINE
      The SDK does not make any network requests. It may still serve cached data.
    • ONE_SHOT

      public static final ConnectionMode ONE_SHOT
      The SDK makes a single poll request and then stops.
    • BACKGROUND

      public static final ConnectionMode BACKGROUND
      The SDK polls at a low frequency while the application is in the background.
  • Method Details