Android Detect Activity Resume Via HOME Or BACK Keys
I have made my application HOME application, so that when you press HOME button, you are redirected to my application. From my application you can open other applications like brow
Solution 1:
onNewIntent()
is fired when an app is running, and receives another intent to be launched. That is why you are seeing it when HOME is pressed.
When BACK is pressed, your app is not going to receive an intent. All that happens is that the apps on top of yours are removed. So your app appears from the back stack with only onResume()
being called.
So that is how you can tell.
For interest, you can look at the source code for the older launchers online, and you will see that onNewIntent()
is used to re-centre the launcher view on the main page i.e. it can help you to see if the HOME key has been pressed twice.
I was exploring this exact topic a few months ago (end 2013), and looking at production launcher code really helped.
Post a Comment for "Android Detect Activity Resume Via HOME Or BACK Keys"