简体   繁体   中英

Android startActivityForResults and returning to calling applications on exceptions

currently i have an application that is called from an external application
The flow is as followed:

External -> A -> B -> C -> External (With data) this is done by retaining A and when C finishes, we return to A and call setResult and finish() in A.

This works fine for most of the use case except if there's a crash somewhere in the process. So for example

External App -> A -> B -> C (CRASHES HERE) It will return to B instead of going back to the external application. this is problematic for my use-case as it's an integrated environment without user interaction.

I have tried overwriting the DefaultExceptionHandler however have not had any luck in trying to get the correct flow. Is there a way to return to the calling application always on a crash?

So far I found using activity.getCallingActivity() and I am calling startActivity with this component. it appears to work.

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