All Products
Search
Document Center

:Compliance description for Public DNS SDK for Harmony

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.

GET_NETWORK_INFO

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. Optional personal information fields and configuration

Optional personal information field

Purpose

Configuration

N/A

N/A

N/A

4. Compliant SDK initialization solution

/// The unique initialization method.
static  getInstance();
/*!
 * @brief Enable the initialization API of the authentication feature.
 * @details Initialize the SDK, enable the authentication feature, and specify the Public DNS account ID and the secret that are required for the authentication feature.
 * @param accessKeyId The Public DNS account ID.
 * @param accesskeySecret The secret that is required for authentication.
 */
Init(ctx:Context,accountID:string,accessKeyId:string,accessKeySecret:string)

Sample code

import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
import { window } from '@kit.ArkUI';
import { Alipdns,schemaType,DNSDomainInfo,DNSlogger } from 'alipdnslibrary';

const AccountID = 'Replace ****** with the account ID displayed on the Access Configuration tab of the Recursive Resolution (Public DNS) page in the Alibaba Cloud DNS console';
const AccessKeID = 'Replace ****** with the AccessKey ID created on the Access Configuration tab of the Recursive Resolution (Public DNS) page in the Alibaba Cloud DNS console';
const AccessKeySecret = 'Replace ****** with the AccessKey secret created on the Access Configuration tab of the Recursive Resolution (Public DNS) page in the Alibaba Cloud DNS console';

export default class EntryAbility extends UIAbility {
  onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
    // ************* Ali pdns-sdk configuration begins *************
    let alipdns = Alipdns.getInstance();
    alipdns.Init(this.context,AccountID,AccessKeID,AccessKeySecret);
    alipdns.setKeepAliveDomains(['*****','*****']);
    alipdns.setSchemaType(schemaType.https);
    alipdns.preLoadDomains(alipdns.QTYPE_V4,['*****','*****','*****']);
    // ************* Ali pdns-sdk configuration ends *************
  }

  // Omit other code
}