Mobile monitoring SDK compliance (Android)

Updated at:
Note

In compliance with laws and regulations such as China's Personal Information Protection Law, Data Security Law, and Cybersecurity Law, you, as an app developer or operator, are required to respect and protect the personal information of your end users. You must not collect or use personal information in violation of these regulations. This guide helps you meet these requirements and protect the rights of your end users when using the mobile monitoring SDK.

1. Required system permissions

Permission

Required

Purpose

INTERNET

Yes

Allows the SDK to access the network to report app crash logs, performance logs, and remote logs.

ACCESS_NETWORK_STATE

Yes

To collect network information for log analysis in the console.

WAKE_LOCK

No

To allow memory analysis to run in the background and detect memory leaks.

2. Features and personal information

Feature

Personal information collected

Purpose of collection

Configuration and example

Mobile monitoring

device information (brand, model, resolution, CPU), system information (system version, language), network information (carrier, network type)

Used for multi-dimensional issue analysis.

Not applicable

3. Optional field configuration

Optional fields

Purpose of collection

Configuration and example

device information (model, resolution)

  1. To identify which devices have performance issues.

Apm.setPrivacySwitch(Apm.DISABLE_DEVICE_MODEL | Apm.DISABLE_SCREEN_RESOLUTION);

system information (system version)

  1. To identify which operating systems have performance issues.

Apm.setPrivacySwitch(Apm.DISABLE_OS_VERSION);

network information (carrier, network type)

  1. To identify which network conditions cause performance issues.

Apm.setPrivacySwitch(Apm.DISABLE_NETWORK_INFO);

4. Compliant initialization

import com.aliyun.emas.apm.Apm;
import com.aliyun.emas.apm.ApmOptions;

// SDK configuration method
public void preStart(@NonNull ApmOptions apmOptions);

// You must ensure that the end user agrees to the Privacy Policy before you call Apm.start().
public Boolean start();
Important
  • You can call the Apm.preStart(...) method in Application.onCreate() before the end user agrees to the Privacy Policy. This method registers lifecycle callbacks.

  • Call the Apm.start() method only after the end user agrees to the Privacy Policy.

Code example

import com.aliyun.emas.apm.Apm;
import com.aliyun.emas.apm.ApmOptions;
import com.aliyun.emas.apm.crash.ApmCrashAnalysisComponent;
import com.aliyun.emas.apm.performance.ApmPerformanceComponent;
import com.aliyun.emas.apm.remote.log.ApmRemoteLogComponent;

// Call in Application.onCreate()
Apm.preStart(new ApmOptions.Builder()
      .setApplication(application)
      .setAppKey("appKey") // Replace with your AppKey
      .setAppSecret("appSecret") // Replace with your AppSecret
      .setAppRsaSecret("appRsaSecret") // Replace with your AppRsaSecret
      .addComponent(ApmRemoteLogComponent.class)
      .addComponent(ApmCrashAnalysisComponent.class)
      .addComponent(ApmPerformanceComponent.class)
      .build());

// Optional: Disable the collection of device, system, and network information. 
// If disabled, this information is not displayed in the console.
Apm.setPrivacySwitch(Apm.DISABLE_DEVICE_MODEL | Apm.DISABLE_SCREEN_RESOLUTION | Apm.DISABLE_OS_VERSION | Apm.DISABLE_NETWORK_INFO);

// Call Apm.start() only after the end user agrees to your Privacy Policy.
Apm.start();