HTTPDNS SDK compliance guide (Harmony)

更新时间:
复制 MD 格式

Note

Laws and regulations, such as the Personal Information Protection Law, the Data Security Law, and the Cybersecurity Law, require app developers and operators to respect and protect the personal information of end users. App developers and operators must not collect or use personal information in violation of these laws. This guide explains how to use the HTTPDNS software development kit (SDK) in a compliant manner to protect the personal information of end users.

I. System permissions requested by the HTTPDNS SDK

Permission

Required

Purpose

INTERNET

Yes

The basic permission that allows the SDK to connect to the network. It is used to perform domain name resolution in the cloud.

GET_NETWORK_INFO

Yes

Checks the network status. Used to resolve the IP addresses of cached domain names from the cloud when the network changes.

II. HTTPDNS SDK features and related personal information

Feature

Personal information collected

Purpose of collection

Configuration and example

Domain name resolution

(Basic feature)

Not applicable

Not applicable

Not applicable

III. Configuration for optional personal information fields in the HTTPDNS SDK

Optional personal information field

Purpose of collection

Configuration and example

Not applicable

Not applicable

Not applicable

IV. Compliant initialization configuration for the HTTPDNS SDK

export namespace httpdns {

  /**
   * Gets an instance of the HttpDns interface.
   */
  export async function getService(accountId: string): Promise<IHttpDnsService>

  /**
   * Configures the HttpDns instance. This must be called before getService to apply the configuration during initialization.
   */
  export function configService(accountId: string, config: HttpDnsConfig)
}
Important
  • The httpdns.configService() method can be called before the user agrees to the Privacy Policy.

  • Ensure that the user agrees to the Privacy Policy before calling the httpdns.getService() method.

Code example

import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
import { window } from '@kit.ArkUI';
import { httpdns } from '@aliyun/httpdns';

const ACCOUNT_ID = 'Replace this with the Account ID from your Alibaba Cloud HTTPDNS console'

export default class EntryAbility extends UIAbility {
  onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
    // ************* Start of initialization configuration *************
    httpdns.configService(ACCOUNT_ID, {
      context: this.context,
    });
    // ************* End of initialization configuration *************
  }

  // Other code is omitted.
}


async function callHttpDns() {
  // Get the HTTPDNS service instance. The HttpDnsService is initialized on the first call.
  // Ensure that the user agrees to the Privacy Policy before calling httpdns.getService.
  const httpdnsService = await httpdns.getService(ACCOUNT_ID);
  // Other code is omitted.
}