Also what is the earliest point/hook in the code where I can begin to store in SharedPreferences? Can I access in Application.create()?
On Feb 5, 6:03 pm, Hari Edo <[email protected]> wrote: > Save data when the user's no longer interacting with it. And even > when they are. As you point out, there are no guaranteed callbacks. > The system assumes that if you're idle, you can be killed. > > On Feb 5, 8:57 pm, AndroidDevTime <[email protected]> wrote: > > > I would like to handle application shutdown gracefully. Whether the > > user ends the application or the system decides the kill the process, > > I want to know the best place to put hooks in the application to > > detect and handle this. I know that application level components have > > lifecycle methods the conform to system events, but I really want the > > best practice on this at the application level. This is after all an > > application level shutdown, so i want an app level(not just component > > level) handling. > > > Not really sure where to put the global app shutdown code: > > > In Application.terminate() ?: Not really guaranteed to get called. > > > In a service?: I have n services. > > > In an activity? : ok but just for the view data. > > > The only thing I can think is to have a service dedicated to this > > shutdown activity manage the application level data, but I don't > > really want to start a service at a time when my app is getting > > shutdown perhaps for resource consumption. > > > Perhaps one could just let each component deal with it, however I > > have shared data/state (that is not a preference) across the > > components, and I see no reason why one of those components other than > > the application (subclass) should be dealing with application global > > data management. > > > Thanks -- 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

