activity lifecycle - Android: What is a good place to release used resources that is not onDestroy? -


I'm looking for a place to put my clean up code (like issuing file handles, shutting down services do).

Here's the scenario: I have an app with many activities and there is a service running in the background. This service reaches many sensors and files, in this way, if the app has been aborted to stop the battery drain from the user, then it has to be stopped. However, the app is in the background and / or the service must be turned on when the screen is off. I'm looking for a place to stop the service in code OnDestroy () My activities are not a good idea because Android can call it (even if my app is running) or can not call it anytime

Is there a good place to release resources used by an app when the user deliberately terminates it?


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -