通过使用DefaultExceptionHandler电子邮件发送崩溃报告 [英] sending crash report via email using DefaultExceptionHandler

查看:373
本文介绍了通过使用DefaultExceptionHandler电子邮件发送崩溃报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图捕获所有崩溃,并允许用户通过电子邮件发送自己定制的错误报告。

i'm trying to capture all crashes and allow the user to send my own customized error report via email.

这是一个非常临时的解决方案,因为我需要发送的应用程序和其他信息的日志。它不旨在被发送到最终用户。只有一个非常小的测试者。

it's a very temporary solution since i need to send the logs of the app and other information . it is not intended to be sent to end users . only a very tiny group of testers.

不管怎样,我已经创建了一个从java.lang.Thread.UncaughtExceptionHandler扩展一个类,具有功能uncaughtException()。我注册它使用Thread.setDefaultUncaughtExceptionHandler(),它确实抓住崩溃。

anyway, i've created a class that extends from java.lang.Thread.UncaughtExceptionHandler , and that has a function uncaughtException() . i register to it using Thread.setDefaultUncaughtExceptionHandler() and it really catches crashes.

函数存储在外部存储一些数据,并立即打开电子邮件应用程序(的Gmail)发送崩溃报告。

the function stores some data on the external storage and immediately opens the email app (gmail) to send the crash report.

它工作得很好,但由于某些原因,当我关闭电子邮件应用程序,应用程序本身将重新启动。

it works quite well, but for some reason, when i close the email app, the app itself is restarted.

我试过的多种组合:


  • System.exit(0)

  • android.os.Process.killProcess(android.os.Process.myPid());

  • 调用默认的UncaughtExceptionHandler。

没有奏效。它关闭应用程序,但只要接近的电子邮件应用程序,该应用程序重新启动本身

none worked. it does close the app, but as soon as close the email app, the app restarts itself

我也无法找出如何做的事情,捕捉崩溃​​(如烤面包,对话框,...)。

i also can't find out how to do things that work on the UI thread when capturing the crashes (such as toasts, dialogs,...) .

这是我试过是打开一个新的活动,将发送崩溃报告另一种解决方案。可悲的是应用程序甚至没有开始活动。

another solution that i've tried is opening a new activity that will send the crash report. sadly the app didn't even start the activity.

另一件事我已经试过从ACRA图书馆看书,想弄清楚他们如何有处理崩溃。可悲的是,我不明白是怎么回事,在那里,甚至从一个较高的水平。

another thing i've tried is to read from the ACRA library, trying to figure out how they have handled crashes. sadly, i didn't understand what is going on there, even from a high level.

我已经在这里搜索(在SO)的解决方案,并发现了一些帖子,但没有一个为我工作。

i've searched here (on SO) for a solution and found some posts, but none has worked for me.

我怎样才能避免被重新启动应用程序关闭电子邮件应用程序时?

how can i avoid the app from being restarted when closing the email app?

推荐答案

阅读您的问题后,我想我给崩溃报告一展身手。

After reading your question I thought I'd give crash reporting a go.

下面是我的结果: https://github.com/slightfoot/android-crash-reporting

它拥有所有你想要的,可能更多。

It has all that you wanted and probably more.

这篇关于通过使用DefaultExceptionHandler电子邮件发送崩溃报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆