All Products
Search
Document Center

Alibaba Cloud DNS:Android SDK compliance instructions

Last Updated:Nov 25, 2025
Note

According to the Personal Information Protection Law, Data Security Law, Network Security Law, and other regulatory requirements, application developers must respect and protect end users' personal information and are prohibited from collecting or using such information unlawfully while providing network services. These compliance instructions have been specifically formulated to help developers better implement requirements related to the protection of users' personal information when using the HTTPDNS SDK and to avoid situations that might infringe upon end users' personal information rights.

I. Android SDK system permission requirements

Permission

Required

Purpose

INTERNET

Yes

This permission allows the SDK to connect to the Internet for domain name resolution in the cloud. This is the basic permission for network connection.

ACCESS_NETWORK_STATE

Yes

This permission is used to view network status and trigger IP resolution for domain names in the preload method when network transition occurs.

II. Android SDK features and related personal information

Feature

Collected personal information field

Purpose

Configuration

Domain name resolution

(Basic feature)

N/A

N/A

N/A

III. Android SDK compliance initialization configuration

public static void Init(Context ctx, String accountID, String accessKeyId, String accessKeySecret)
Important

You must ensure that users have agreed to the Privacy Policy before calling the DNSResolver.Init() method.

Sample code

public class DnsCacheApplication extends Application{

    private String Account ID = "your Account ID"; //Set the Account ID you used to access the SDK in the console
    private String AccessKey ID = "your AccessKey ID"; //Set the AccessKey ID you used to access the SDK in the console
    private String AccessKey Secret = "your AccessKey Secret"; //Set the AccessKey Secret you used to access the SDK in the console

    @Override
    public void onCreate() {
       super.onCreate();
       DNSResolver.Init(this,Account ID,AccessKey ID,AccessKey Secret); //Set the Account ID, AccessKey ID, and AccessKey Secret used to access the SDK in the console
       //Note: Setting domains for cache retention will automatically initiate resolution at TTL * 75% to ensure that configured domain resolution always hits the cache. However, if users use CDN, this can result in very small TTL values, generating many resolution requests and increasing costs. Please use this method with caution.
       DNSResolver.setKeepAliveDomains(new String[]{"your cache retention domain 1","your cache retention domain 2",...});       
       DNSResolver.getInstance().preLoadDomains(DNSResolver.QTYPE_IPV4,new String[]{"your preload domain 1","your preload domain 2",...}); //Set specified IPV4 type domain pre-resolution, replace preload domains with the domains you want to resolve using Alibaba DNS
    }
}