Crash Analytics SDK compliance guide (Harmony)

Updated at:

Note

In accordance with the Personal Information Protection Law, the Data Security Law, the Cybersecurity Law, and other relevant regulations, app developers and operators (hereinafter referred to as "developers") must respect and protect the personal information of end users when providing network products and services. Developers must not illegally collect or use personal information. This compliance guide is provided to help developers comply with personal information protection requirements when using the Crash Analytics software development kit (SDK) and avoid infringing on the personal information rights of end users.

System permissions requested by the Crash Analytics SDK

Permission

Required

Purpose

INTERNET

Yes

Allows the SDK to connect to the internet to upload crash logs.

GET_NETWORK_INFO

Yes

Allows the application to get data network information for crash log collection.

Crash Analytics SDK features and related personal information

Feature

Personal information fields collected

Purpose of collection

Configuration and example

Crash Analysis

(Basic feature)

Device information (CPU, model, brand, resolution), system info (system version), network information (carrier, network type)

Generates crash and abnormal logs to provide useful information for troubleshooting.

Not applicable

Configuration for optional personal information fields

Optional personal information fields

Purpose of collection

Configuration and example

Not applicable

Not applicable

Not applicable

Compliance-friendly initialization for the Crash Analytics SDK

import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
import { EMAS_APM_Config, APM, ILogger } from '@aliyun/apm'



// To define a custom logger, implement the ILogger interface with a class.
@Sendable
class CustomLog implements ILogger {
  log(level: hilog.LogLevel, msg: string): void {
    console.log(`Custom log level:${level} msg:${msg}`);
  }
}

export default class EntryAbility extends UIAbility {
  onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');

    // APM initialization parameters
    const apm_config = new EMAS_APM_Config({
      context: this.context,
      appKey: 'Your appKey',
      appSecret: 'Your appSecret',
      channel: 'Your channel',
      nick: 'Your nick',
      hilog: true, // SDK hilog switch
      customLogger: new CustomLog() // SDK custom logger
    });

    // Initialize the SDK
    APM.init(apm_config);

    // Start monitoring
    APM.start();
  }
  
  // Other code omitted
 }

Important
  • Ensure the end user agrees to the Privacy Policy before you call the APM.init() and APM.start() methods.