简体   繁体   中英

Prevent android from recreating activity stack after crash

I have an application that is encountering an exception in an activity a few levels down the stack. I am also using ACRA for crash reporting in status bar notifications + dialog mode. What I see happening is that when my process is killed because of the exception, Android recreates the activity stack upto the offending activity's parent. I would like to override this behavior. If my app crashed, I would like it to remain crashed.

There is discussion on this in android-developers:

http://groups.google.com/group/android-developers/browse_thread/thread/b274cfa64b17f535/92d8da160be85748?lnk=gst&q=force+close+restarts#92d8da160be85748

I have also read through the discussion in this stack overflow thread: Prevent Activity Stack from being Restored?

but am looking to see if there is an update in the platform for this or a newer technique. Right now the restart behavior is causing issues with ACRA as the crash report notification is cleared as soon as the activity stack is recreated, leaving the user no time to send the report.

I use ACRA also, and I found that adding forceCloseDialogAfterToast=true to the @ReportCrashes annotation will suppress the restart. The cost, however, is that you get the Android Force Close dialog. I cannot figure out how to get rid of that AND prevent the app restart...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM