接入步骤:
- 在“AppScope/resources/rawfile”目录下添加:agconnect-services.json文件。
- 添加“@hw-agconnect/ohos-apms”依赖,采用方式一添加;
- 在EntryAbility的onCreate中集成崩溃服务,代码如下:
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
//初始化崩溃sdk
let input = this.context.resourceManager.getRawFileContentSync('agconnect-services.json')
let jsonString = util.TextDecoder.create('utf-8', {
ignoreBOM: true
}).decodeWithStream(input, {
stream: false
});
APMS.getInstance().start(this.context, JSON.parse(jsonString));
// 初始化设置为未登录状态
LoginStatusUtil.setIsLogin(false)
}
控制台无成功/失败日志,AppGallery Connect无上报数据。
解决方案
集成SDK后应用启动时若打印如下日志,apms init success.则代表SDK初始化成功。apms init failed: 则代表SDK初始化失败。详情请按照文档指导:https://developer.huawei.com/consumer/cn/doc/AppGallery-connect-Guides/agc-crash-test-arkts-0000001764107046