Okay - I might remember incorrectly (explains why I couldn't find it
again :), but I did some testing on this.

If i force a RuntimeException in a scheduled timer task in a service,
the task will keep on triggering after the exception.

if I force a RuntimeException in a method of a service I do get the
"This application has..." popup however when pressing 'close'
the app restarts and further more it automatically restarts the
service that made the exception (which normally is manually
started after the app is loaded). Thus Android seems to kill the
process, including the service, restart the app it in the state it had
before the exception, thus also restarting the service.


On Apr 14, 1:34 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> msurrowwrote:
> > I remember having read somewhere in the documentation that Android
> > will restart a crashed service or activity.
>
> I think you remember incorrectly.
>
> > What I specifically need to
> > know is what guarantees Android gives when it comes to services,
> > activities etc. failing (as in runtime exceptions) - how Android
> > handles this
>
> It destroys the component. In the case of an activity, it displays the
> "force close" dialog before destroying the component and returns control
> to the previous activity on the stack.
>
> > will it always restart the service
>
> AFAIK, it will not restart the service on a RuntimeException. Android
> should restart the service automatically if Android got rid of the
> service due to a low-memory condition, though I'm not sure that's
> guaranteed.
>
> > Can anyone point me to a place in the documentation that has this
> > information?
>
> No, because, AFAIK, it is not documented.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to *Advanced* Android Development_
> Version 1.4 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to