First of all it is possible to detect the home key event in an indirect way as shown in my post about killing an application when the home key is pressed: How to close Android application?
Also it is possible to determine if an activity is the root activity in its onDestroy() method and then have it call a helper class to perform final processing if it is the root activity. Better yet would be to create a custom activity that all of your activities inherit from, place the final processing logic in the onDestroy() method of the custom activity and then have all subclasses call super.onDestroy() in their onDestroy() method. This is similar to what is done in the aforementioned post: How to close Android application? as well as posts about creating setting screens when the menu button is pressed as well as handling the search button and return button.
I hope this helps.