HarmonyOS 有没有崩溃日志上报收集功能?

如题:HarmonyOS 有没有崩溃日志上报收集功能?

阅读 478
1 个回答

请参考以下方案:

1、应用想要捕获js crash可以使用@ohos.app.ability.errorManager (ErrorManager)。ErrorManager模块提供对错误观察器的注册和注销的能力:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-app-ability-errormanager-V5

可以使用faultLogger通过其查询接口进行主动获取当前的故障信息:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-faultlogger-V5

hiAppEvent.addWatcher方法监听app crash:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-hiviewdfx-hiappevent-V5

2、参考三方库@hw-agconnect/ohos-apms:https://ohpm.openharmony.cn/\#/cn/detail/@hw-agconnect%2Fohos-apms

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进