本演示项目在Unity for Android Build中启用部分华为HMS和AGC服务,对应的类和函数的名称和用法相同。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

8.5 KiB

HuaweiService.apm

Scenario: Monitoring application performance data监控应用性能数据

Description Api Reference
Android: ANR data, startup data, screen data, HTTP/HTTPS network performance data, foreground and background activity data
Android:ANR数据、启动数据、屏幕数据、HTTP/HTTPS网络性能数据、前台和后台活动数据
Basic functions, no interface involved
基础功能,不涉及接口
iOS: Application startup performance data, application screen performance data, HTTP/HTTPS network performance data.
iOS:应用启动性能数据、应用屏幕性能数据、HTTP/HTTPS网络性能数据。
Basic functions, no interface involved
基础功能,不涉及接口
Web: page and network performance data.
Web:页面和网络性能数据。
Basic functions, no interface involved
基础功能,不涉及接口

Scenario: Adding custom tracking records添加自定义跟踪记录

Description Api Reference
Creates a custom trace. traceName indicates the trace name.
创建自定义跟踪记录;启动自定义跟踪;停止自定义跟踪记录,添加自定义属性,添加自定义指标
createCustomTrace(String traceName) apms
Starts a custom trace.
启动、停止自定义跟踪记录
start()、stop() customtrace
Sets the attribute names and values of a custom trace.
设置自定义跟踪记录属性名称和属性值。
putProperty(String propertyName, String propertyValue) customtrace
Removes an existing attribute from a CustomTrace instance.
从CustomTrace实例中移除已存在属性。
removeProperty(String propertyName) customtrace
Obtains a custom attribute value.
获取自定义属性值。
getProperty(String propertyName) customtrace
Adds an indicator value for a custom trace.
增加自定义跟踪记录指标的指标值。
incrementMeasure(String measureName, long measureValue) customtrace
Obtains an indicator value for a custom trace.
获取自定义跟踪记录指标值。
getMeasure(String measureName) customtrace
Adds an indicator for a custom trace.
添加自定义跟踪记录指标。
putMeasure(String measureName, long measureValue) customtrace
Obtains all attributes of a custom trace.
获取自定义跟踪记录的所有属性。
getTraceProperties() customtrace

Scenario: Time-consuming tracking method跟踪方法耗时

Description Api Reference
Creates a custom trace. traceName indicates the trace name.
跟踪方法耗时
@AddCustomTrace(name = "onCreateCustomTrace", enabled = true) apms
C# properties[AddCustomTrace("onCreateCustomTrace", true)]

Scenario: Adding monitoring indicators for specific network requests添加针对特定网络请求的监控指标

Description Api Reference
Creates a network request indicator instance to collect network performance data.
创建网络请求指标实例,用于采集网络性能数据。
createNetworkMeasure(String url, String httpMethod) apms
Sets the request start time/end time and reports network request indicators and custom attribute dat
启动,停止网络请求指标
start()、stop() networkmeasure
Sets the response code of a request.
设置请求的响应码。
setStatusCode(int statusCode) networkmeasure
Sets the request body size.
设置请求体大小。
setBytesSent(long btyesSent) networkmeasure
Sets the response body size.
设置响应体大小。
setBytesReceived(long bytesReceived) networkmeasure
Sets the response body type specified by contentType.
设置响应体contentType类型。
setContentType(String contentType) networkmeasure
Sets the custom attribute name and value of a network request.
设置网络请求的自定义属性名称和属性值。
putProperty(String propertyName, String propertyValue) networkmeasure
Removes an existing attribute from a NetworkMeasure instance.
从NetworkMeasure实例中移除已存在属性。
removeProperty(String propertyName) networkmeasure
Obtains all attributes from a NetworkMeasure instance.
从NetworkMeasure实例中获取所有属性。
getProperties() networkmeasure
Obtains a custom attribute value.
获取自定义属性值。
getProperty(String propertyName) networkmeasure

Scenario: View debug log查看调试日志

Description Api Reference
View APM SDK logs
查看APM SDK日志
android:name="apms_debug_log_enabled"
android:value="false" />
View APM plugin log
查看APM插件日志
gradlew app:assembleDebug --debug --stacktrace

Scenario: Disable ANR monitoring停用ANR监控

Description Api Reference
Sets whether to enable APM to collect performance monitoring data. If this parameter is set to false, APM stops collecting app performance data. The default value is true.
启用ARM监控、停用ANR监控
enableAnrMonitor(boolean enable) apms

Scenario: Disable APM performance monitoring停用APM性能监控

Description Api Reference
Sets whether to enable APM to collect performance monitoring data. If this parameter is set to false, APM stops collecting app performance data. The default value is true.
启用APM监控、停用APM监控
enableCollection(boolean enable) apms

Scenario: Scene frame rendering and loading performance monitoringAPM Game Plugin服务入口

Description Api Reference
Start APM Game Plugin service.
开始APM Game Plugin服务
start()
Stop APM Game Plugin service.
停止APM Game Plugin服务
stop()
Start recording scene loading time.
开始记录场景加载时间
startLoadingScene(GameAttribute gameAttribute)
Stop recording scene loading time.
停止记录场景加载时间
stopLoadingScene(string scene)
Save current game properties.
保存当前游戏属性
setCurrentGameAttribute(GameAttribute gameAttribute)
Set the reporting frequency of game performance data, unit: minute.
设置游戏性能数据上报频率,单位:分钟
setReportMinRate(int intervalMin)
Whether to enable APM Game Plugin service.
是否启用APM Game Plugin服务
enableGamePlugin(boolean enabled)