home button

when the user press on the home button, how i can change anything in my app before the screen closed?

thanks,