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 ApplicationInfoBuilder
Returns a configuration builder for the SDK's application metadata.static HttpConfigurationBuilder
Returns a configuration builder for the SDK's networking configuration.static ComponentConfigurer<EventProcessor>
noEvents()
Returns a configuration object that disables analytics events.static PollingDataSourceBuilder
Returns a configuration builder for using polling mode to get feature flag data.static EventProcessorBuilder
Returns a configuration builder for analytics event delivery.static ServiceEndpointsBuilder
Returns a builder for configuring custom service URIs.static StreamingDataSourceBuilder
Returns 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
PollingDataSourceBuilder
methods, and pass it toLDConfig.Builder.dataSource(ComponentConfigurer)
:LDConfig config = new LDConfig.Builder() .dataSource(Components.pollingDataSource().initialReconnectDelayMillis(500)) .build();
Setting
LDConfig.Builder.offline(boolean)
totrue
will 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
EventProcessorBuilder
properties, 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)
totrue
will 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
StreamingDataSourceBuilder
methods, and pass it toLDConfig.Builder.dataSource(ComponentConfigurer)
:LDConfig config = new LDConfig.Builder() .dataSource(Components.streamingDataSource().initialReconnectDelayMillis(500)) .build();
Setting
LDConfig.Builder.offline(boolean)
totrue
will supersede this setting and completely disable network requests.- Returns:
- a builder for setting streaming connection properties
- See Also:
-