浏览代码

add apm game doc

/main
meng.yan 3 年前
当前提交
d6852abc
共有 2 个文件被更改,包括 30 次插入23 次删除
  1. 13
      Documentation/api/apiIndexApm.md
  2. 40
      Documentation/apm.md

13
Documentation/api/apiIndexApm.md


---|---|---
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.<br>``启用APM监控、停用APM监控``|enableCollection(boolean enable)|[apms](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/apms)
#### Scenario: Scene frame rendering and loading performance monitoring``APM Game Plugin服务入口``
| Description | Api | Reference |
---|---|---
Start APM Game Plugin service.<br>``开始APM Game Plugin服务``|start()|
Stop APM Game Plugin service.<br>``停止APM Game Plugin服务``|stop()|
Start recording scene loading time.<br>``开始记录场景加载时间``|startLoadingScene(GameAttribute gameAttribute)|
Stop recording scene loading time.<br>``停止记录场景加载时间``|stopLoadingScene(string scene)|
Save current game properties.<br>``保存当前游戏属性``|setCurrentGameAttribute(GameAttribute gameAttribute)|
Set the reporting frequency of game performance data, unit: minute.<br>``设置游戏性能数据上报频率,单位:分钟``|setReportRate(int intervalMin)|
Whether to enable APM Game Plugin service.<br>``是否启用APM Game Plugin服务``|enableGamePlugin(boolean enabled)|

40
Documentation/apm.md


Before integrating the APM SDK, ensure that your app has integrated the AppGallery Connect SDK and AppGallery Connect plug-in. For details, please refer to [Getting Started with Android.](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-get-started)
**Note**:
**Note**:
1. Copy the `agconnect-services.json` file to `Assets/Plugins/Android/`

```
dependencies {
implementation 'com.huawei.agconnect:agconnect-core:1.4.2.301'
implementation 'com.huawei.agconnect:agconnect-core:1.5.2.300'
}
```

maven {url 'https://developer.huawei.com/repo/'}
}
}
buildscript {
repositories {
google()

}
classpath 'com.huawei.agconnect:agcp:1.4.2.301'
classpath 'com.huawei.agconnect:agcp:1.5.2.300'
}
}
```

dependencies {
// ...
// Add APM SDK library dependency
implementation 'com.huawei.agconnect:agconnect-apms:1.4.1.303'
implementation 'com.huawei.agconnect:agconnect-apms:1.5.2.300'
implementation 'com.huawei.agconnect:agconnect-apms-game:1.5.2.300'
}
```

apply plugin: 'com.huawei.agconnect.apms'
// Apply the AGC plugin
apply plugin: 'com.huawei.agconnect'
2. Add the APM plug-in to the baseProjectTemplate.gradle file.
```

// To benefit from the latest APM feaures, update your Android Gradle Plugin dependency to at least v3.3.2
classpath 'com.android.tools.build:gradle:3.3.2'
// Add the dependency for the APM plugin
classpath 'com.huawei.agconnect:agconnect-apms-plugin:1.4.1.303'
classpath 'com.huawei.agconnect:agconnect-apms-plugin:1.5.2.300'
}
}
```

```
void Start()
{
6. Bind buttons and interfaces in scripts
![Images/apm/apm_settingup7.png](Images/apm/apm_settingup7.png)

- Step 1: Create a repo from: https://github.com/Unity-Technologies/unity-hms_sdk/tree/apm and checkout to “apm” branch.
- Step 2: Replace `agconnect-services.json` file from your remote project and configure your gradle files, refer to Part 2. Step 1 to Step 3.
- Step 2: Replace `agconnect-services.json` file from your remote project and configure your gradle files, refer to Part 2. Step 1 to Step 3.
- Step 3: Open Unity Hub, add HuaweiServiceDemo Project (Unity version 2019.3).

> Microsoft (R) Visual C# Compiler version 2.9.1.65535 (9d34608e)
> Copyright (C) Microsoft Corporation. All rights reserved.
>
>
> error CS0009: Metadata file '/Users/yanmeng/Desktop/unity_agc_new/unity-hms_sdk/hmsDemo/Library/ScriptAssemblies/Unity.Timeline.Editor.dll' could not be opened -- Image is too small.
> Assets/HuaweiHms/src/hms/Wrapper/fundation/HmsClass.cs(72,25): warning CS0693: Type parameter 'T' has the same name as the type parameter from outer type 'HmsClass<T>'

- Step 6: build android apk and run on Android device. Use logcat to check whether test cases are executed successfully.
![Images/apm/apm_11.png](Images/apm/apm_11.png)
正在加载...
取消
保存