最小化时关闭程序 [英] close application when minimized

查看:127
本文介绍了最小化时关闭程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开始我的应用程序显示通过网络闪屏,并检查当前用户仍然premium。

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

我的问题:我开始了我的应用程序之前,我去睡觉和pressing home键最小化它。在早上,我再次推出的应用程序,它恢复从夜活动。该应用程序从未真正退出,并没有显示我的闪屏,并不能检查,如果用户仍然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)?

推荐答案

您应该写在 onResume()方法,以便premium用户检查逻辑
如果活动处于暂停或背景状态下,它会检查
它的逻辑将启动每次。

You should write the Premium user check logic in your onResume() method so that if the activity is in pause or background state it will check the logic every time it will be launched .

这篇关于最小化时关闭程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆