Is there a good way to check if an entire application (not an activity!) is closed by the user? I want to log the time a user spends using the application, so a simple activity onPause()
,onStop()
or onDestroy()
is not sufficient.
There are several ways an application can be closed, either the user pressing the home button, 开发者_运维技巧search button or simply leaving the application. Is there a unified (eg. simple) way to see if any of these things happened?
There are several ways an application can be closed, either the user pressing the home button, search button or simply leaving the application.
Neither of these actually closes the application. The activities will continue to run unless you explicitly call finish()
or the system kills them when it runs out of resources.
Why is not sufficient to use onResume()
and onPause()
?
will overriding finalize() to the App class (that extends Application) help for this job ?
if not , maybe a reference inside this class to another class that has this method?
精彩评论