I saw in some applications, with an unexpected error, after the application was closed, a dialog box popped up with a message and a request to send logs to the mail. How to implement this?

  • What prevents to create a dynamic array (this is the most banal is simple), where each cell will be a string with a trace. Places where you expect unexpected errors are placed in a try-catch , the catch returns a straighttrack, which you save to a dynamic array. And in onDestroy create a dialogue that offers to send errors to you - and then send it at least in the form of json . Crutch of course, but the question is quite general. - Silento

1 answer 1

Such functionality can be obtained using the Application Crash Reports for Android library and others like it.

If the application is distributed through Google Play, then all the crashes and ANR your application can be viewed in the Google Play Developer Console ( if the user has confirmed sending the data about more beautiful ).

But technically, you can implement it yourself: when an exception occurs, catch it with try-catch and in the catch implement the method of sending logs somewhere. Another thing is whether to write a bicycle when everything is already written ...

  • And tell me about "if the user confirmed sending data about more beautiful", the application is distributed through Google Play, there were several crashes in the console, the statistics of crashes in the console and ANR did not change - user210886
  • @ user210886, And when you fell, did you press the Report button? - post_zeew
  • Such a button and did not get out - user210886
  • @ user210886, Strange, if the application is downloaded from Google Play , then this button, in theory, should be. - post_zeew 4:18
  • But this is not connected with custom firmware and root rights? - user210886