Class Components
Some of the configuration options in LDConfig.Builder affect the entire SDK, but others are
specific to one area of functionality, such as how the SDK receives feature flag updates or processes
analytics events. For the latter, the standard way to specify a configuration is to call one of the
static methods in Components, apply any desired configuration change to the object that that
method returns, and then use the corresponding method in LDConfig.Builder to use that
configured component in the SDK.
- Since:
- 3.3.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic ApplicationInfoBuilderReturns a configuration builder for the SDK's application metadata.static HooksConfigurationBuilderhooks()Returns a builder for configuring hooks.static HttpConfigurationBuilderReturns a configuration builder for the SDK's networking configuration.static ComponentConfigurer<EventProcessor>noEvents()Returns a configuration object that disables analytics events.static PluginsConfigurationBuilderplugins()Returns a builder for configuring plugins.static PollingDataSourceBuilderReturns a configuration builder for using polling mode to get feature flag data.static EventProcessorBuilderReturns a configuration builder for analytics event delivery.static ServiceEndpointsBuilderReturns a builder for configuring custom service URIs.static StreamingDataSourceBuilderReturns a configuration builder for using streaming mode to get feature flag data.
-
Method Details
-
applicationInfo
Returns a configuration builder for the SDK's application metadata.Passing this to
LDConfig.Builder.applicationInfo(com.launchdarkly.sdk.android.integrations.ApplicationInfoBuilder), after setting any desired properties on the builder, applies this configuration to the SDK.LDConfig config = new LDConfig.Builder() .applicationInfo( Components.applicationInfo() .applicationId("authentication-service") .applicationVersion("1.0.0") ) .build();- Returns:
- a builder object
- Since:
- 4.1.0
- See Also:
-
httpConfiguration
Returns a configuration builder for the SDK's networking configuration.Passing this to
LDConfig.Builder.http(ComponentConfigurer)applies this configuration to all HTTP/HTTPS requests made by the SDK.LDConfig config = new LDConfig.Builder() .http( Components.httpConfiguration() .connectTimeoutMillis(3000) .proxyHostAndPort("my-proxy", 8080) ) .build();- Returns:
- a factory object
- See Also:
-
noEvents
Returns a configuration object that disables analytics events.Passing this to
LDConfig.Builder.events(ComponentConfigurer)causes the SDK to discard all analytics events and not send them to LaunchDarkly, regardless of any other configuration.LDConfig config = new LDConfig.Builder() .events(Components.noEvents()) .build();- Returns:
- a configuration object
- See Also:
-
pollingDataSource
Returns a configuration builder for using polling mode to get feature flag data.By default, the SDK uses a streaming connection to receive feature flag data from LaunchDarkly. To use the default behavior, you do not need to call this method. However, if you want to customize the behavior of the connection, call this method to obtain a builder, change its properties with the
PollingDataSourceBuildermethods, and pass it toLDConfig.Builder.dataSource(ComponentConfigurer):LDConfig config = new LDConfig.Builder() .dataSource(Components.pollingDataSource().initialReconnectDelayMillis(500)) .build();Setting
LDConfig.Builder.offline(boolean)totruewill supersede this setting and completely disable network requests.- Returns:
- a builder for setting streaming connection properties
- See Also:
-
sendEvents
Returns a configuration builder for analytics event delivery.The default configuration has events enabled with default settings. If you want to customize this behavior, call this method to obtain a builder, change its properties with the
EventProcessorBuilderproperties, and pass it toLDConfig.Builder.events(ComponentConfigurer):
To completely disable sending analytics events, useLDConfig config = new LDConfig.Builder() .events(Components.sendEvents().capacity(500).flushIntervalMillis(2000)) .build();noEvents()instead.Setting
LDConfig.Builder.offline(boolean)totruewill supersede this setting and completely disable network requests.- Returns:
- a builder for setting event-related options
- See Also:
-
serviceEndpoints
Returns a builder for configuring custom service URIs.Passing this to
LDConfig.Builder.serviceEndpoints(com.launchdarkly.sdk.android.integrations.ServiceEndpointsBuilder), after setting any desired properties on the builder, applies this configuration to the SDK.LDConfig config = new LDConfig.Builder() .serviceEndpoints( Components.serviceEndpoints() .relayProxy("http://my-relay-hostname:80") ) .build();- Returns:
- a builder object
- See Also:
-
streamingDataSource
Returns a configuration builder for using streaming mode to get feature flag data.By default, the SDK uses a streaming connection to receive feature flag data from LaunchDarkly. To use the default behavior, you do not need to call this method. However, if you want to customize the behavior of the connection, call this method to obtain a builder, change its properties with the
StreamingDataSourceBuildermethods, and pass it toLDConfig.Builder.dataSource(ComponentConfigurer):LDConfig config = new LDConfig.Builder() .dataSource(Components.streamingDataSource().initialReconnectDelayMillis(500)) .build();Setting
LDConfig.Builder.offline(boolean)totruewill supersede this setting and completely disable network requests.- Returns:
- a builder for setting streaming connection properties
- See Also:
-
hooks
Returns a builder for configuring hooks. Passing this toLDConfig.Builder.hooks(com.launchdarkly.sdk.android.integrations.HooksConfigurationBuilder), after setting any desired hooks on the builder, applies this configuration to the SDK.List hooks = myCreateHooksFunc(); LDConfig config = new LDConfig.Builder() .hooks( Components.hooks() .setHooks(hooks) ) .build();- Returns:
- a
HooksConfigurationBuilderthat can be used for customization
-
plugins
Returns a builder for configuring plugins. Passing this toLDConfig.Builder.plugins(com.launchdarkly.sdk.android.integrations.PluginsConfigurationBuilder), after setting any desired plugins on the builder, applies this configuration to the SDK.List plugins = getPluginsFunc(); LDConfig config = new LDConfig.Builder() .plugins( Components.plugins() .setPlugins(plugins) ) .build();- Returns:
- a
PluginsConfigurationBuilderfor plugins configuration
-