java - How can I notify another application that my application has failed? -
In my application, I start an activity which is in another application (Eclipse Project) in the following manner: / P>
intent = new intent (); Intent.setAction (game.getLaunch ()); Intent.addFlags (Intent.FLAG_ACTIVITY_SINGLE_TOP); StartActivityForResult (intent, game.getId ());
If this second application is finished, I call:
MySecondApplication.this.setResult (getGameId ()); MySecondApplication.this.finish ();
This works fine if the second application ends normally, but I want to capture any unpleasant exception in the second application and first inform the application that the second application fails has gone. So I tried to use UncaughtExceptionHandler in my other application:
thread.set DefaultAdvancedAxception handler (handler);
This method works fine
@ override public zero uncaughtException (Thread Thread, Throttle Ex) {System.out.println ("In Exception My second application "); }
However, I can not do anything else, instead of creating a sysout if I tried to do some complex work, such as a warning dialog, or somehow the first application warning, it Not everyone is said to be. I think this is because the second application was already exhausted due to the exception. But then how can I inform my first application that the other has ended unexpectedly? Any signals?
Edit # 1:
With the help of Pentium 10, I was able to inform the application for the first time that the other was crashed by sending a broadcast on the first application without any reason. is. .
However, my problem is not fully solved: I can notify my first application, but my second application where the exception occurred is not actually "finished" it is just a black screen. So how can I solve it?
Edit # 2:
I could stop calling second activity by:
(activity) reference) .finish () ;
While the reference is second activity, however, the intention of the second activity to be transmitted now takes a long time through the first activity. It takes about 30 seconds or more. Why does it take too long?
You need to start some service to issue a broadcast or to notify it.
This second question will help you
Comments
Post a Comment