All Products
Search
Document Center

:Compliance description for public DNS SDK (Android)

Last Updated:May 19, 2025
Note

The application developer must respect and protect the personal information of end users and cannot illegally collect or use it when the application developer provides network services based on the laws, regulations, and regulatory requirements, including Personal Information Protection Law, Data Security Law, and Cybersecurity Law. This guide is intended to help developers protect personal information and prevent any infringement on the personal information rights of end users.

1. System permissions

Permission

Required

Purpose

INTERNET

Yes

The basic permission to allow the SDK to connect to the Internet. The permission is used for domain name resolution in the cloud.

ACCESS_NETWORK_STATE

Yes

You can view the network status. The permission is used to trigger the IP address of the domain name in the cloud resolution cache when the network type is changed.

2. Features and required personal information

Feature

Collected personal information field

Purpose

Configuration

Domain name resolution

(Basic feature)

N/A

N/A

N/A

3. Compliant SDK initialization solution

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

Make sure that you agree to the Privacy Policy before you call DNSResolver.Init().

Sample code

public class DnsCacheApplication extends Application{

    private String Account ID = "Your Account ID"; //Specify the account ID that is used to access the SDK in the Alibaba Cloud DNS console.
    private String AccessKey ID = "Your AccessKey ID"; //Specify the AccessKey ID that is used to access the SDK in the Alibaba Cloud DNS console.
    private String AccessKey Secret = "Your AccessKey Secret"; //Specify the AccessKey secret that is used to access the SDK in the Alibaba Cloud DNS console.

    @Override
    public void onCreate() {
       super.onCreate();
       DNSResolver.Init(this,Account ID,AccessKey ID,AccessKey Secret); //Specify the account ID, AccessKey ID, and AccessKey secret that are used to access the SDK in the Alibaba Cloud DNS console.
       //Note: Specify the domain names for which you want to enable the cache retention feature. After the cache retention feature is enabled, the domain names are automatically resolved when 75 percent of the TTL period elapses. This ensures that DNS requests for the domain names always match cached DNS results during resolution. If you add a domain name to the Alibaba Cloud Content Delivery Network (CDN), you may charged more for the surging number of DNS requests caused by reduced TTL. Proceed with caution when you run this command.
       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",...}); //Specify IPv4 domain names that you want to pre-resolve and that you want to use Alibaba Cloud Public DNS to resolve.
    }
}