我有一个android应用程序,我需要一个功能或任何广播接收器,可以检查应用程序是否关闭。.我不需要在每个活动中调用destroy(该应用程序中大约有20个活动)应用程序类中的功能
public class ApplicationLifeCycleManager implements ActivityLifecycleCallbacks {
/** Manages the state of opened vs closed activities, should be 0 or 1.
* It will be 2 if this value is checked between activity B onStart() and
* activity A onStop().
* It could be greater if the top activities are not fullscreen or have
* transparent backgrounds.
*/
private static int visibleActivityCount = 0;
/** Manages the state of opened vs closed activities, should be 0 or 1 …Run Code Online (Sandbox Code Playgroud) android android-lifecycle android-activity android-activitymanager