Initial activity when uncaughtException () is called

I want to start a new activity from mine UncaughtExceptionHandlerwhen an uncaught exception appears. Is it possible?

I think that the current activity cannot start a new child activity in the "error" state, because I always get the following errors:

07-14 14:34:06.075: INFO/ActivityManager(74): Starting activity: Intent { flg=0x10000000 cmp=de.rwth/system.ErrorHandler (has extras) }
07-14 14:34:06.615: WARN/ActivityManager(74): Activity pause timeout for HistoryRecord{4338f8d8 de.rwth/.main}
07-14 14:34:16.115: WARN/ActivityManager(74): Launch timeout has expired, giving up wake lock!
07-14 14:34:16.628: WARN/ActivityManager(74): Activity idle timeout for HistoryRecord{433a89d8 de.rwth/system.ErrorHandler}

I tried to start the child activity from a new thread, because I thought that the current thread might be in a state where it is not allowed to start a new action, but that did not work either.

So does anyone know how this can work? How can I prevent current activity from blocking everything while in this error state? is there any way to set an exception to handle?

+3
source share
1 answer

What you need to do is to specify the mapping of exceptions Activityin your manifest file and install android:taskAffinityand android:processvalues different from your primary process. Then you need to specify an intent filter and use it to trigger activity and transfer data.

By default, taskAffinity is set from the main tag <application>and is the same page name as the tag <manifest>. You probably want something likeandroid:taskAffinity="org.example.package.TASK.ExceptionDisplay"

<application> . , android:process, , , , , android:process=":exception_process".

.

+5

Source: https://habr.com/ru/post/1754610/


All Articles