最小化时关闭应用程序

Close app when minimized

我有类似的问题 this

On start my app displays a splash screen and checks via network if the current user is still premium.

My problem: I started my app right before I went to bed and minimized it by pressing the home button. In the morning I launched the app again and it resumed the activity from the night. The app never really quit, my splash screen was not shown and and it couldn't check if the user is still premium.

So how can I achieve my app to be closed after a certain time (e.g. when the app is minimized)?

但问题是应用程序中有一部分我可以全屏观看视频,这里我使用 android 的默认播放器。因此,当应用程序在观看时最小化然后再次打开应用程序时,不会调用 onResume 并且无法检查它是否是注册用户。视频播放器将继续播放视频。有什么方法可以让我在播放和最小化视频时终止应用程序吗?当使用主页键最小化应用程序时,是否有任何调用的方法?是否有可能在每个设备中检测到主页按键事件并在那里编写一些代码?请帮忙提供一些新的想法!!!

现在我知道为什么我的名声总是很低了。谢谢 Dan Hulme。你是对的,我只想正确使用应用程序生命周期。我想使用 onRestart 而不是 onResume。这已经为我完成了工作。谢谢大家