All Products
Search
Document Center

HTTPDNS:Compliance of HTTPDNS SDK for Android

Last Updated:Jun 08, 2026

Lists the system permissions, personal information fields, and initialization methods required for HTTPDNS SDK for Android to comply with privacy regulations.

Note

Under the Personal Information Protection Law, Data Security Law, and Cybersecurity Law, app developers must protect end-user personal information. This guide helps you meet these requirements when using the HTTPDNS SDK.

1. Required system permissions

Permission

Required

Purpose

INTERNET

Yes

Allows the SDK to access the Internet for cloud-based domain name resolution.

ACCESS_NETWORK_STATE

Yes

Reads network status to refresh the cloud DNS resolution cache when the network type changes.

2. Features and personal information collected

Feature

Personal information collected

Purpose

Configuration and example

Domain name resolution

(Basic feature)

N/A

N/A

N/A

3. Compliance-aware SDK initialization

// The SDK configuration method. Configure only the HTTPDNS configuration information.
// The configuration method consumes less time and does not affect the user experience of cold start of the app.
public static void init(String accountId, InitConfig config);

// Obtain the HTTPDNS service instance. The first time you obtain an instance, HttpDnsService is initialized.
// Make sure that you agree to the Privacy Policy before you call HttpDns.getService(). 
public static HttpDnsService getService(Context applicationContext, String accountID)
Important
  • You can call HttpDns.init() before the user agrees to the Privacy Policy.

  • Call HttpDns.getService() only after the user agrees to the Privacy Policy.

Sample code

InitConfig config = InitConfig.Builder()
    // Specify the initial region.
    .setRegion(currentRegion)
    // Specify whether to enable HTTPS. By default, HTTP is enabled.
    .setEnableHttps(enableHttps)
    // Specify the timeout period of a service request. Unit: milliseconds. The default period is 2 seconds. The maximum priod is 5 seconds.
    .setTimeout(2 * 1000)
    // Specify whether to enable local caching. By default, local caching is disabled.
    .setEnableCacheIp(true)
    // Specify whether expired IP addresses can be returned. By default, expired IP addresses can be returned.
    .setEnableExpiredIp(true)
    // Specify a list of IPv4 addresses that you want to probe to obtain the optimal IPv4 address.
    .setIPRankingList(ipRankingItemJson.toIPRankingList())
    // Specify a custom time-to-live (TTL) for the cache.
    .configCacheTtlChanger(ttlChanger)
    // Configure the domain name list of fixed IP addresses, which can optimize the internal logic of the SDK and reduce the resolution frequency.
    .configHostWithFixedIp(hostListWithFixedIp)
    // Configure a domain name resolution policy that executed by using HTTPDNS.
    .setNotUseHttpDnsFilter(notUseHttpDnsFilter)
    .build()

HttpDns.init(accountID, config);

// Make sure that you agree to the Privacy Policy and complete authorization before you call HttpDns.getService(...). 
HttpDns.getService(...)
InitConfig config = new InitConfig.Builder()
    // Specify the initial region.
    .setRegion(currentRegion)
    // Specify whether to enable HTTPS. By default, HTTP is enabled.
    .setEnableHttps(enableHttps)
    // Specify the timeout period of a service request. Unit: milliseconds. The default period is 2 seconds. The maximum priod is 5 seconds.
    .setTimeout(2 * 1000)
    // Specify whether to enable local caching. By default, local caching is disabled.
    .setEnableCacheIp(true)
    // Specify whether expired IP addresses can be returned. By default, expired IP addresses can be returned.
    .setEnableExpiredIp(true)
    // Specify a list of IPv4 addresses that you want to probe to obtain the optimal IPv4 address.
    .setIPRankingList(list)
    // Specify a TTL for the cache.
    .configCacheTtlChanger(ttlChanger)
    // Configure the domain name list of fixed IP addresses, which can optimize the internal logic of the SDK and reduce the resolution frequency.
    .configHostWithFixedIp(hostListWithFixedIp)
    // Configure a domain name resolution policy that executed by using HTTPDNS.
    .setNotUseHttpDnsFilter(notUseHttpDnsFilter)
    .build();

HttpDns.init(accountID, config);

// Make sure that you agree to the Privacy Policy and complete authorization before you call HttpDns.getService(...). 
HttpDns.getService(...);