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.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to