Does the SDK auto-refresh domain name resolution results after a network transition?

更新时间:
复制 MD 格式

Question 1: Does the SDK auto-refresh domain name resolution results after a network transition?

  • To enable the software development kit (SDK) to automatically re-resolve domain names after a real-time network transition, such as from 4G to Wi-Fi, use the following method:

    Android:

    /**
      * Specifies whether to auto-refresh the resolution results for all domain names after a network transition.
      * If you enable this feature, the SDK automatically refreshes the resolution results for all domain names when the network changes.
      * This consumes a small amount of traffic.
      * @param enable
      */
    InitConfig.Builder setPreResolveAfterNetworkChanged(boolean enable)
    Note

    This method was added in version 2.4.0.

    iOS:

    /**
      * Specifies whether to auto-refresh the resolution results for all domain names after a network transition.
      * If you enable this feature, the SDK automatically refreshes the resolution results for all domain names when the network changes.
      * This consumes a small amount of traffic.
      * @param enable
      */
    - (void)setPreResolveAfterNetworkChanged:(BOOL)enable;

    Harmony:

    /**
     * HTTPDNS configuration
     */
    export interface HttpDnsConfig {
      // Other code is omitted.
    
      /**
       * Specifies whether to automatically resolve domain names after a network environment transition.
       */
      reResolveCachedHostsAfterNetworkChanged?: boolean;
    
      // Other code is omitted.
    }

Question 2: What is the granularity of a network transition that triggers the auto-refresh feature? For example, does it trigger when switching between 4G and 3G, from 4G to airplane mode, or between two 4G SIM cards?

  • A network transition is a switch between the following states: Wi-Fi, cellular, and no network. Switching between 3G, 4G, and 5G is not considered a network transition. The SDK does not handle SIM card switches separately.