Package 

Interface FeatureSdkCore

  • All Implemented Interfaces:
    com.datadog.android.api.SdkCore

    
    public interface FeatureSdkCore
     implements SdkCore
                        

    Extension of SdkCore containing the necessary methods for the features development.

    SDK core is always guaranteed to implement this interface.

    • Method Detail

      • registerFeature

         abstract Unit registerFeature(Feature feature)

        Registers a feature to this instance of the Datadog SDK.

        Parameters:
        feature - the feature to be registered.
      • getFeature

         abstract FeatureScope getFeature(String featureName)

        Retrieves a registered feature.

        Parameters:
        featureName - the name of the feature to retrieve
      • updateFeatureContext

         abstract Unit updateFeatureContext(String featureName, Boolean useContextThread, Function1<Map<String, Object>, Unit> updateCallback)

        Updates the context if exists with the new entries. If there is no context yet for the provided featureName, a new one will be created.

        Parameters:
        featureName - Feature name.
        useContextThread - Whenever update of the context should happen on the context processing thread or not.
        updateCallback - Provides current feature context for the update.
      • getFeatureContext

         abstract Map<String, Object> getFeatureContext(String featureName, Boolean useContextThread)

        Retrieves the context for the particular feature.

        Parameters:
        featureName - Feature name.
        useContextThread - Whenever context read should happen on the context processing thread or not.
      • removeEventReceiver

         abstract Unit removeEventReceiver(String featureName)

        Removes events receive for the given feature.

        Parameters:
        featureName - Feature name.
      • createOkHttpCallFactory

         abstract Call.Factory createOkHttpCallFactory(Function1<OkHttpClient.Builder, Unit> block)

        Creates an OkHttp okhttp3.Call.Factory with custom configuration that shares the SDK's underlying thread pool and connection pool.

        This method allows features to configure their HTTP client while efficiently sharing resources (dispatcher thread pool, connection pool) across the entire SDK. Using a shared base client reduces resource consumption and improves performance through better connection reuse.

        Example:

        val callFactory = sdkCore.createOkHttpCallFactory {
            callTimeout(45, TimeUnit.SECONDS)
            writeTimeout(30, TimeUnit.SECONDS)
        }
        Parameters:
        block - Configuration block to customize the OkHttpClient.Builder
      • setAnonymousId

         abstract Unit setAnonymousId(UUID anonymousId)

        Allows the given feature to set the anonymous ID for the SDK.

        Parameters:
        anonymousId - Anonymous ID to set.
      • getName

         abstract String getName()

        Name of the current SDK instance.

      • getTime

         abstract TimeInfo getTime()

        The current time (both device and server).

      • getService

         abstract String getService()

        Name of the service (given during the SDK initialization, otherwise package name is used).