确定何时单击应用程序图标以在android中启动应用程序 [英] Determine when application icon is clicked to launch the app in android
问题描述
Android中是否有任何方法可以确定用户何时单击应用程序图标以启动应用程序?我的意思是说一个用户正在使用我的应用程序.然后,他按下Home键,结果应用程序进入后台.一段时间后,他再次单击应用程序图标.我的问题是是否为此给我回电?
Is there any way in android to determine when the user clicked the app icon to launch the app ? I mean say a user was using my app. Then he presses the home key as a result of which the app goes to the background. After sometime he clicks the app icon again. My question is do I get a call-back for this ?
推荐答案
请注意,我在启动器活动中使用了标志 android:clearTaskOnLaunch ="true"
.结果,调用了它的onResume方法,我可以确定单击了启动器图标
Just to inform, I used the flag android:clearTaskOnLaunch="true"
in my launcher activity. As a result, its onResume method was called and I could identify that the launcher icon was clicked
这篇关于确定何时单击应用程序图标以在android中启动应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!