does Android allow calling signal() to catch native code crashes? arranging for signal reception then communicating to the Java space that there's been a native library crash might be an option if so.
>Um. Regardless of how quickly the system restarts your activity, >this is a wretched user experience. I can hardly bring myself to >help someone do this. > >Definitely don't schedule an alarm to do this. Please. > >You are NEVER going to be able to fully prevent whatever was behind >your activity (typically from home) appearing. Your app crashed. >Its UI is gone. We aren't going to wait around for it, we are >showing what was behind it. > >As far as when an activity is restarted -- if the process running >the foreground activity goes away, the system will throw away that >activity if it does not have a valid saved state for it (typically >meaning it is paused and has given the system the result of >onSaveInstanceState from before the pause). Once it has decided >whether or not to throw away that activity, it will resume whatever >activity is now at the top of the stack. If this is one of your >activities -- either because you have another behind the one that >crashed, or the one that crashed was somehow it the settled pause >state -- then it will start your process again to show that top >activity. > >On Wed, Oct 14, 2009 at 10:35 AM, mik...@tat ><<mailto:[email protected]>[email protected]> >wrote: > > >Hello, > >we are developing an application where we are depending on a native, >custom-written library which sometimes crashes. When the Activity >crashes (it's the Activity's SurfaceView that crashes, either while >resuming or pausing Activity) we would like to automatically restart >the Activity that was just running, preferably without seeing the idle >screen in between. > >What we find strange is that sometimes, our Activity is restarted by >Android automatically after the crash, and sometimes not. How does >Android decide this? Is it somehow dependant on exactly what the >Activity was doing at the time of the crash and if that was considered >important enough to restart? How can we force a restart to make sure >the Activity doesn't quit after a crash? > >Some notes: > >Running on device flashed with Android 1.5. >The Activity is running as singleInstance. Doesn't seem to make much >difference which mode it is though. > >Other methods we have tried are: > >1) Since we can predict when crash is going to happen(but not stop >it), use AlamrManager to start the Activity again via an Intent, 3 >seconds later. Has the disadvantages that 1) need to be able to >predict crash 2) if crash takes longer than 3 seconds (normally about >2s) it won't work 3) Idle screen is seen for about ~1 s, since some >slack is needed. > >2) Start a Service, then let the Service (which always seems to be >restarted by Android after crashing) start the Activity in its onStart >method. Has the disadvantage that Android doesn't restart the service >until 5 seconds after the crash, so the idle screen is seen quite >along time before Activity restarts. Is it possible to modify how long >it takes before the Service is restarted by the Android system? > > >Any help would be greatly appreciated. > > > > >-- >Dianne Hackborn >Android framework engineer ><mailto:[email protected]>[email protected] > >Note: please don't send private questions to me, as I don't have >time to provide private support, and so won't reply to such e-mails. > All such questions should be posted on public forums, where I and >others can see and answer them. > > > -- jason.vp.engineering.particle --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

