I see a difference in behavior of onNewIntent calls between 2.3.4 and 4.2.
I have an activity with launchMode=singleTask
. According to my understanding of how singleTask works, each time when activity is restored from the task list, onNewIntent
should be called.
This is what happens on 2.3.4 (LG P990) when I start an activity, press "home" to move it to foreground and then restore from task list (longpress "home"):
D/NewIntent(23314): onPause
D/NewIntent(23314): onNewIntent
D/NewIntent(23314): onResume
D/NewIntent(23314): onPause
D/NewIntent(23314): onNewIntent
D/NewIntent(23314): onResume
Same on 4.2 (Nexus 4):
D/NewIntent(12960): onPause
D/NewIntent(12960): onResume
D/NewIntent(12960): onPause
D/NewIntent(12960): onResume
As you see, onNewIntent is not called.
Can someone explain me what is going on?
I had the same issue with a Galaxy Nexus on 4.2.2. The code was developed on an emulated Nexus S (API 15). I ended up moving the logic from onNewIntent() to onResume().
During my headaches whilst trying to solve this dilemma Re-showing-a-singletask-activity I had to create a "middle man" -- i.e. a separate (Self) IntentService which would receive a Bundle via its onHandleIntent method, and then immediately fire off a new intent (to your singleTask Activity).
I have just tested on devices running 2.3.7 and 4.1.2 - onNewIntent called on singleTask activity every time.
hth
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With