Package 

Class TDConfig

    • Method Detail

      • getInstance

         static TDConfig getInstance(Context context, String token, String url)

        Obtain the TDConfig instance. This example can be used to initialize ThinkingAnalyticsSDK. Each SDK instance corresponds to one TDConfig instance.

        Parameters:
        context - app context
        token - APP ID
        url - The URL of the data receiving end must be the complete URL with the protocol; otherwise, an exception will be thrown
      • getInstance

         static TDConfig getInstance(Context context, String token, String url, String name)

        Obtain the TDConfig instance. This example can be used to initialize ThinkingAnalyticsSDK. Each SDK instance corresponds to one TDConfig instance.

        Parameters:
        context - app context
        token - APP ID
        url - The URL of the data receiving end must be the complete URL with the protocol; otherwise, an exception will be thrown
        name - instance name
      • setMutiprocess

         TDConfig setMutiprocess(boolean isSupportMultiProcess)

        Specifies whether data reporting by multiple processes is supported. By default, data reporting by multiple processes is disabledData reporting by multiple processes has certain performance loss, and cross-process communication is a relatively slow process.

        Parameters:
        isSupportMultiProcess - multiple processes is supported
      • setSessionTimeout

         TDConfig setSessionTimeout(long timeoutMillis)

        Sets how long, in milliseconds, the SDK keeps the current {@code #session_id} after the last event. The next event starts a new session id when the gapreaches this value. App foreground/background transitions do not reset thegap. A login, account switch, or logout also makes the next event start anew session. Repeated login with the same account keeps the current session.The default is 5 minutes ({@code 300000}).A value less than or equal to 0 falls back to the default.

        TDConfig config = TDConfig.getInstance(context, APP_ID, SERVER_URL);
        config.setSessionTimeout(10 * 60 * 1000L);
        
        Parameters:
        timeoutMillis - session timeout in milliseconds
      • getSessionTimeout

         long getSessionTimeout()

        Returns the session timeout in milliseconds.

      • getCurrentServerUrl

         String getCurrentServerUrl()

        Get the current server URL being used (primary or backup).The URL list is built dynamically: [serverUrl, backupUrl1, backupUrl2, ...]

      • switchToNextUrl

         void switchToNextUrl()

        Switch to the next URL in the list (for retry logic).

      • isEncryptGcmSupported

         boolean isEncryptGcmSupported()

        Whether the receiver is known to support AES-GCM. Report data is only encrypted when thisreturns true, so that a new SDK talking to an old receiver falls back to plaintext insteadof uploading data the receiver cannot decrypt.

        The flag comes from the remote config field {@code secret_key.mode} and is persisted, sofrom the second launch on it is available before the config request returns. On the veryfirst launch it stays unknown until the config response arrives.