Detect when app icon is clicked to launch app in android

Is there a way in android to detect when the user has clicked an app icon to launch the app? I mean the user was using my application. He then presses the home key, causing the app to go to the background. After a while, he clicks the app icon again. My question is: am I getting a callback for this?

+2


a source to share


3 answers


Just to inform, I used a flag android:clearTaskOnLaunch="true"

in my launch activity. This resulted in the onResume method being called and I could identify that the launcher icon was clicked



+3


a source


It will call the onResume () method if the application is already on the stack. And if the application is not on the stack then it will call the onCreate () method.



This mechanism is based on the launchMode parameter specified for the activity.

0


a source


please read http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle

How many activities your application has, you will receive a callback onResume()

for the last open activity.

0


a source







All Articles