Take screenshot when application crashes in Android

757 views Asked by At

I am developing a Bug Reporter in my custom ROM and want to know if there is a mechanism of taking screenshot when an application has crashed.

I know that handleApplicationCrash() method of ActvityManagerService is called when an application crashes. From here an Intent with action Intent.ACTION_APP_ERROR is broadcasted which contains BUG_REPORT.

I also know that BugReportReceiver in frameworks/base/packages/Shell also gets Intent with extras EXTRA_BUG_REPORT and EXTRA_SCREENSHOT. But I am not able to trace from where screenshot is generated and this Intent is broadcast.

I need help in writing code to take a screenshot automatically when an application has crashed.

1

There are 1 answers

2
RajSharma On

f you want to save information about the app crash, you must go with acra library

ACRA is a library enabling Android Application to automatically post their crash reports to a Google Doc form. It is targeted to android applications developers to help them get data from their applications when they crash or behave erroneously. (Taken from link)

A crash reporting feature for android apps is native since Android 2.2 (FroYo) but only available through the official Android Market (and with limited data). ACRA is a great help for Android developers :

I hope this should help you...