Class Components
- java.lang.Object
-
- com.launchdarkly.sdk.android.Components
-
public abstract class Components extends java.lang.ObjectProvides configurable factories for the standard implementations of LaunchDarkly component interfaces.Some of the configuration options in
LDConfig.Builderaffect 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 inComponents, apply any desired configuration change to the object that that method returns, and then use the corresponding method inLDConfig.Builderto use that configured component in the SDK.- Since:
- 3.3.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ApplicationInfoBuilderapplicationInfo()Returns a configuration builder for the SDK's application metadata.static HttpConfigurationBuilderhttpConfiguration()Returns a configuration builder for the SDK's networking configuration.static ComponentConfigurer<EventProcessor>noEvents()Returns a configuration object that disables analytics events.static PollingDataSourceBuilderpollingDataSource()Returns a configuration builder for using polling mode to get feature flag data.static EventProcessorBuildersendEvents()Returns a configuration builder for analytics event delivery.static ServiceEndpointsBuilderserviceEndpoints()Returns a builder for configuring custom service URIs.static StreamingDataSourceBuilderstreamingDataSource()Returns a configuration builder for using streaming mode to get feature flag data.
-
-
-
Method Detail
-
applicationInfo
public static ApplicationInfoBuilder 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:
LDConfig.Builder.applicationInfo(com.launchdarkly.sdk.android.integrations.ApplicationInfoBuilder)
-
httpConfiguration
public static HttpConfigurationBuilder 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:
LDConfig.Builder.http(ComponentConfigurer)
-
noEvents
public static ComponentConfigurer<EventProcessor> 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:
sendEvents(),LDConfig.Builder.events(ComponentConfigurer)
-
pollingDataSource
public static PollingDataSourceBuilder 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:
LDConfig.Builder.dataSource(ComponentConfigurer)
-
sendEvents
public static EventProcessorBuilder 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:
noEvents(),LDConfig.Builder.events(ComponentConfigurer)
-
serviceEndpoints
public static ServiceEndpointsBuilder 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:
LDConfig.Builder.serviceEndpoints(com.launchdarkly.sdk.android.integrations.ServiceEndpointsBuilder)
-
streamingDataSource
public static StreamingDataSourceBuilder 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:
LDConfig.Builder.dataSource(ComponentConfigurer)
-
-