> I have a Service, it is started by StartService(...), my program never > stop it. The service can be destroied in other cases, such as: > Stop it in Application->Running Services > run command: Kill <pid> > System kill it in case of memory low > Phone shut down > other unlist condition... > > I want to clean up and save settings whenever the service is > destroied. I tried do this in onDestroy() or finalize(), Neither > satisfies my demand, onDestroy() is only called whe "Stop it in > Application->Running Services", finalize() is never called in all > above condition. > > Where is the right point? pls help me, THANK YOU!
There is no "right point" for those scenarios. Your code will not be called. Hence, do not wait to be destroyed to "clean up and save settings". And, please do not leave your service running all of the time: http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-are-not/ -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Books: http://commonsware.com/books.html -- 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

