Class ClientContext


  • public class ClientContext
    extends java.lang.Object
    Configuration information provided by the LDClient when creating components.

    The getter methods in this class provide information about the initial configuration of the client. This includes properties from LDConfig, and also values that are computed during initialization. It is preferable for components to copy properties from this class rather than to retain a reference to the entire LDConfig object.

    The actual implementation class may contain other properties that are only relevant to the built-in SDK components and are therefore not part of this base class; this allows the SDK to add its own context information as needed without disturbing the public API.

    All properties of this object are immutable; they are set at initialization time and do not reflect any later state changes in the client.

    Since:
    3.3.0
    • Constructor Detail

      • ClientContext

        public ClientContext​(android.app.Application application,
                             java.lang.String mobileKey,
                             LDLogger baseLogger,
                             LDConfig config,
                             java.lang.String environmentName,
                             boolean evaluationReasons,
                             HttpConfiguration http,
                             boolean initiallySetOffline,
                             ServiceEndpoints serviceEndpoints)
      • ClientContext

        protected ClientContext​(ClientContext copyFrom)
    • Method Detail

      • getApplication

        public android.app.Application getApplication()
        The Android application object.
        Returns:
        the application
      • getBaseLogger

        public LDLogger getBaseLogger()
        The base logger for the SDK.
        Returns:
        a logger instance
      • getConfig

        public LDConfig getConfig()
        Returns the full configuration object. THIS IS A TEMPORARY METHOD that will be removed prior to release-- the goal is to NOT retain the full LDConfig in these components, but until we have moved more of the config properties into subconfiguration builders, this is necessary.
        Returns:
        the configuration object
      • getEnvironmentName

        public java.lang.String getEnvironmentName()
        Returns the configured environment name.
        Returns:
        the environment name
      • isEvaluationReasons

        public boolean isEvaluationReasons()
        Returns true if evaluation reasons are enabled.
        Returns:
        true if evaluation reasons are enabled
      • getHttp

        public HttpConfiguration getHttp()
        Returns the HTTP configuration.
        Returns:
        the HTTP configuration
      • isInitiallySetOffline

        public boolean isInitiallySetOffline()
        Returns true if the initial configuration specified that the SDK should be offline.
        Returns:
        true if initially set to be offline
      • getMobileKey

        public java.lang.String getMobileKey()
        Returns the configured mobile key.

        In multi-environment mode, there is a separate ClientContext for each environment, corresponding to the LDClient instance for that environment.

        Returns:
        the mobile key
      • getServiceEndpoints

        public ServiceEndpoints getServiceEndpoints()
        Returns the base service URIs used by SDK components.
        Returns:
        the service endpoint URIs