How to let Hockeyapp collect Crash Reports of a Service?

扶醉桌前 提交于 2020-01-03 06:36:24

问题


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.

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)

Any idea?


回答1:


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 is the same ID as used in the Activity.

However, the crash of the Service will only be committed to HockeyApp when the Activity restarts.



来源:https://stackoverflow.com/questions/26096917/how-to-let-hockeyapp-collect-crash-reports-of-a-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!