Android - 检测从家中或历史记录启动的应用程序 [英] Android - detecting application launch from home or history

查看:19
本文介绍了Android - 检测从家中或历史记录启动的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

检测何时从主屏幕/历史屏幕启动 Android应用程序"的最佳方法是什么?

What is the best way to detect when an Android "Application" has been launched from the Home screen/History screen?

基本上,我想要实现的是强制用户每次返回应用程序时登录到某些屏幕(即,一旦登录,他们就可以完全访问所有活动,但基本上我希望他们重新-当他们通过在主屏幕上启动返回应用程序时进行身份验证).

Basically, what I'm trying to achieve is force the user to login to certain screens each time they come back to the app (i.e. they have full access to all activities once logged in, but essentially I want them to re-authenticate when they come back to the app via launching on the home screen).

我知道之前有人问过类似的问题(即如何记录应用程序的启动) - 但我所见过的问题都无法解决我的问题.欢迎所有想法...

I know similar questions have been asked before (i.e. how to log launches of an app) - but none that I have seen has yet been able to solve my problem. All ideas welcome...

推荐答案

检测何时从主屏幕/历史屏幕启动 Android应用程序"的最佳方法是什么?

What is the best way to detect when an Android "Application" has been launched from the Home screen/History screen?

你不能,AFAIK.

基本上,我想要实现的是强制用户每次返回应用程序时登录到某些屏幕(即,一旦登录,他们就可以完全访问所有活动,但基本上我希望他们重新-当他们通过在主屏幕上启动返回应用程序时进行身份验证).

Basically, what I'm trying to achieve is force the user to login to certain screens each time they come back to the app (i.e. they have full access to all activities once logged in, but essentially I want them to re-authenticate when they come back to the app via launching on the home screen).

请使用合理、用户友好的登录系统.例如,如果您觉得他们的登录凭据随时间过时,则强制他们重新登录.您可以通过检查 onCreate() 中的凭据来执行此操作,如果它们过时,请调用 startActivity() 以启动您的登录活动(或弹出您的登录对话框,或任何您登录的方式).

Please use a sensible, user-friendly login system. For example, if you feel that their login credentials are stale based upon time, then force them to log in again. You can do this by checking the credentials in onCreate(), and if they are stale, call startActivity() to launch your login activity (or pop up your login dialog, or whatever is your means of logging them in).

当然,更好的方法是完全跳过登录.除非这是密码保险箱"、银行应用程序或其他需要高于平均水平的安全性的东西,否则您不需要他们登录,如果您的用户认为您的登录要求是不必要的,他们会感到恼火.大多数移动应用程序不需要身份验证.

Of course, an even better approach is to skip the login entirely. Unless this is a "password safe", a banking app, or something else that needs higher-than-average security, you do not need them to log in, and your users will get irritated if they feel that your login requirement is unnecessary. Most mobile applications do not require authentication.

根据他们到达活动的方式强制登录是用户敌对的.您是在告诉那些屈尊将手机用于您的应用以外的事情的用户,他们是二等公民.

Forcing a login based upon how they reached the activity is user-hostile. You are telling users that deign to use their phones for things other than your app that they are second-class citizens.

这篇关于Android - 检测从家中或历史记录启动的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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