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?
1 answer
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
Reportbutton? - 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
|
try-catch, thecatchreturns a straighttrack, which you save to a dynamic array. And inonDestroycreate a dialogue that offers to send errors to you - and then send it at least in the form ofjson. Crutch of course, but the question is quite general. - Silento