如何让Hockeyapp收集服务的崩溃报告? [英] How to let Hockeyapp collect Crash Reports of a Service?
问题描述
我将HockeyApp SDK添加到了我的Android应用中.这按预期工作,并且我还获得了有关主要活动和相关类的崩溃报告.
I added the HockeyApp SDK to my Android App. This works as expected, and I also get crash reports of the main activity and the associated classes.
但是,我没有弄清楚如何获取[在我的情况下是&绑定]服务. UpdateManager仅接受活动,并定义为
However, I did not figure out how I will get crash reports of the [in my case started & bound] Service. The UpdateManager only accepts Activities and is defined as
UpdateManager.register(Activity, String)
有什么主意吗?
推荐答案
只要 Activity 调用 UpdateManager 的适当方法就足够了. Service 必须仅通过在以下代码中添加此行来注册 CrashManager . onCreate()
It is sufficient when the Activity calls the appropriate methods of the UpdateManager. The Service must only register the CrashManager by adding this line in e.g. onCreate()
public void onCreate() {
...
CrashManager.register(this, HOCKEY_APP_ID);
}
HOCKEY_APP_ID 与活动中使用的ID是相同的.
HOCKEY_APP_ID is the same ID as used in the Activity.
但是,仅当Activity重新启动时,服务崩溃才会提交给HockeyApp.
However, the crash of the Service will only be committed to HockeyApp when the Activity restarts.
这篇关于如何让Hockeyapp收集服务的崩溃报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!