[英]Determine where app was started from e.g. Home Screen, App Drawer, or Play Store
Is there a way to determine whether an Android app (main activity) was started by tapping its icon on the Home Screen, or from other places (such as the App Drawer, or even the Open button in the Google Play Store app)? 是否可以通过在主屏幕上点击图标或从其他位置(例如App Drawer甚至Google Play Store应用程序中的“打开”按钮)来确定Android应用程序(主要活动)是否已启动?
I need do do this in Java code, preferably in a method such as OnCreate. 我需要用Java代码执行此操作,最好使用OnCreate之类的方法。
For android apps, once it's started, it always run until manually closed. 对于android应用,一旦启动,它将一直运行直到手动关闭。 You can press the history button to see whether the app that you are interested is there.
您可以按历史记录按钮查看您感兴趣的应用程序是否在那里。 If it is, it means that it's running in the background.
如果是,则表示它在后台运行。
I don't think there's a way to tell whether the app is running from Home Screen ... etc. 我认为没有办法判断应用程序是否正在从主屏幕运行...等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.