Obsolete
Status Update
Comments
en...@gmail.com <en...@gmail.com> #2
This appears to still be occurring, and is very confusing for someone trying to learn
this system. I'm unclear from the earlier post whether they saw this go away once
they returned to the Home screen and launched the test app a 3rd time, but as I'm
trying this now it appears to never work correctly.
this system. I'm unclear from the earlier post whether they saw this go away once
they returned to the Home screen and launched the test app a 3rd time, but as I'm
trying this now it appears to never work correctly.
je...@gmail.com <je...@gmail.com> #3
This bug is moat assuredly NOT defunct.
je...@gmail.com <je...@gmail.com> #4
I misread "defect" as "defunct". Oops. Sorry for the confusion.
ma...@gmail.com <ma...@gmail.com> #5
I think this same behavior is seen in launching an app after downloaded from market place, or from a
download through the browser.
All three: eclipse, marketplace, and browser, launch our apps using this intent flag:
Intent { flags=0x10000000
and they all have the same behavior. User launches, navigates to a new activity. Hit home screen. Try
returning to the app. The root activity is presented instead of the one they last left off at. To make matters
worst, this root activity is just presented on top of the task launched previously. So hitting the back button
can move all the way back to the original task.
If there's some set of flags we can specify in the manifest to prevent this behavior that would be great.
Otherwise it's utterly confusing for users and I'd be surprised if there's not a way around this.
download through the browser.
All three: eclipse, marketplace, and browser, launch our apps using this intent flag:
Intent { flags=0x10000000
and they all have the same behavior. User launches, navigates to a new activity. Hit home screen. Try
returning to the app. The root activity is presented instead of the one they last left off at. To make matters
worst, this root activity is just presented on top of the task launched previously. So hitting the back button
can move all the way back to the original task.
If there's some set of flags we can specify in the manifest to prevent this behavior that would be great.
Otherwise it's utterly confusing for users and I'd be surprised if there's not a way around this.
ro...@gmail.com <ro...@gmail.com> #6
wtf!!!!!
su...@gmail.com <su...@gmail.com> #7
Hi,
When is this issue supposed to get fixed.
I am facing similar scenario.
Task 1 -->Activity A --> Press back , code is such that Activity A is still there in
Activity stack.
Then in same task Activity B is launched which further launches Activity C using
NEW_TASK flag.
Pressing Back key from Activity C , Activity A is shown. ====> This is strange
behaviour
Press back again and Activity B is shown. ====> Still more confusing.
When is this issue supposed to get fixed.
I am facing similar scenario.
Task 1 -->Activity A --> Press back , code is such that Activity A is still there in
Activity stack.
Then in same task Activity B is launched which further launches Activity C using
NEW_TASK flag.
Pressing Back key from Activity C , Activity A is shown. ====> This is strange
behaviour
Press back again and Activity B is shown. ====> Still more confusing.
ch...@orr.me.uk <ch...@orr.me.uk> #8
If you're launching your default Activity directly from Eclipse, you can't be
guaranteed that you'll get the same behaviour as manually launching it from the icon
on your device.
Just edit your Launch Configuration in Eclipse to change "Launch Action" from "Launch
Default Activity" to "Do Nothing".
Android should just document this particular issue.
guaranteed that you'll get the same behaviour as manually launching it from the icon
on your device.
Just edit your Launch Configuration in Eclipse to change "Launch Action" from "Launch
Default Activity" to "Do Nothing".
Android should just document this particular issue.
ge...@gmail.com <ge...@gmail.com> #9
Agrees with markww. This is more than an Eclispe isssue. I am not finding any cases
where the activity stacjk is preserved. Something deeper is going on...
where the activity stacjk is preserved. Something deeper is going on...
to...@gmail.com <to...@gmail.com> #10
This has been confusing me for weeks.. glad I found this thread. This behaviour could
do with being better documented.
do with being better documented.
vi...@gmail.com <vi...@gmail.com> #11
I can't believe such an issue still has 'New' status being created 1 Year ago!!
The issue is VERY important, because EVERY app upgrade is vulnerable.
Could anybody suggest some sort of workaround?
The issue is VERY important, because EVERY app upgrade is vulnerable.
Could anybody suggest some sort of workaround?
ch...@orr.me.uk <ch...@orr.me.uk> #12
I suggested a workaround in comment 8, but this was fixed in an ADT release months ago.
ch...@gmail.com <ch...@gmail.com> #14
I am experiencing the same issue in comment 5. However, the app works perfectly fine when I run from eclipse. When I publish and download from the server, it displays the same behavior as comment 5. Additionally, when I go back into the application, and just start hitting the back button until the application exits, I cannot recreate the issue...even if I force stop the application adn start it up again. I always force stop the application and uninstall it before reinstalling it for testing.
I know this post is rather old, but if someone has a suggestion for me, please let me know.
I know this post is rather old, but if someone has a suggestion for me, please let me know.
ge...@gmail.com <ge...@gmail.com> #15
Chris,
I never resolved exactly what was going on when I had this issue - but it appeared to go away as my management of memory leaks improved. Maybe I never really had the issue the other guys reported at all. I just had leaks and an unpredictable stack as a result.
If you are not using MAT then it might be a good first place to start. I found this useful a while back
http://ttlnews.blogspot.com/2010/01/attacking-memory-problems-on-android.html
There may be more up to date blogs about now - but I am a little out of the loop now as most of my work is currently focussed on GWT/Appengine.
I never resolved exactly what was going on when I had this issue - but it appeared to go away as my management of memory leaks improved. Maybe I never really had the issue the other guys reported at all. I just had leaks and an unpredictable stack as a result.
If you are not using MAT then it might be a good first place to start. I found this useful a while back
There may be more up to date blogs about now - but I am a little out of the loop now as most of my work is currently focussed on GWT/Appengine.
in...@bigredzebra.com <in...@bigredzebra.com> #16
This problem is still there in 2.2 anyway. The flag that you mention that is set in the Intent (in comment 5) is Intent.FLAG_ACTIVITY_NEW_TASK.
It would be nice if this got fixed as it probably causes a lot of developer pain.
It would be nice if this got fixed as it probably causes a lot of developer pain.
du...@gmail.com <du...@gmail.com> #17
Yeah, I just spent the better part of a day's work hunting for a leak that wasn't there. This should at least be some place where it is easier to find.
bs...@gmail.com <bs...@gmail.com> #18
I experience the same issue as comment 5, in all of those scenarios it is occurring, not just in Eclipse. I looked into Comment 13's code for a workaround and it seems to be working good so far - initial opening of a fresh install now seems to keep the stack intact.
bc...@gmail.com <bc...@gmail.com> #19
This bug was reported over 3 years ago! What is is going to take to get a fix?
dr...@gmail.com <dr...@gmail.com> #20
Fixed required here too, lost 3 days of development time on this!
ra...@gmail.com <ra...@gmail.com> #21
I solved this issue whith the following code in the onCreate() method:
if (!isTaskRoot()) {
final Intent intent = getIntent();
final String intentAction = intent.getAction();
if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) &&
intentAction != null && intentAction.equals(Intent.ACTION_MAIN)) {
finish();
}
}
Opposed to other proposed solutions, this does not require the declaration of "android.permission.GET_TASKS"
if (!isTaskRoot()) {
final Intent intent = getIntent();
final String intentAction = intent.getAction();
if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) &&
intentAction != null && intentAction.equals(Intent.ACTION_MAIN)) {
finish();
}
}
Opposed to other proposed solutions, this does not require the declaration of "android.permission.GET_TASKS"
ne...@gmail.com <ne...@gmail.com> #22
#21 thank you, very helpful solution.
le...@gmail.com <le...@gmail.com> #23
Thank you radu (#21)! This seems to have done the trick without the extra permission.
I agree with mark (#5), this is happening on the device. When I do a fresh/re-install from the device and I immediately hit the "Open" button from the install screen, sometimes I also receive a warning from the system:
12-12 21:02:15.424: W/ActivityManager(1428): startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=blah.blah/blah.blah.StartupActivity bnds=[0,197][480,293] }
Perhaps this is why that flag is being set in the first place?
I agree with mark (#5), this is happening on the device. When I do a fresh/re-install from the device and I immediately hit the "Open" button from the install screen, sometimes I also receive a warning from the system:
12-12 21:02:15.424: W/ActivityManager(1428): startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=blah.blah/blah.blah.StartupActivity bnds=[0,197][480,293] }
Perhaps this is why that flag is being set in the first place?
ye...@gmail.com <ye...@gmail.com> #24
Thanks #21!
I spent 2 days trying to figure this issue
I spent 2 days trying to figure this issue
[Deleted User] <[Deleted User]> #25
#21 It is working if we are resuming to the before 1 hour as after 1 hour it is not working . DO you have any idea what is happening???
vi...@gmail.com <vi...@gmail.com> #26
> #21 It is working if we are resuming to the before 1 hour as after 1 hour it is not working . DO you have any idea what is happening???
Have you tried (#13)?
Have you tried (#13)?
dw...@acm.org <dw...@acm.org> #27
This problem STILL exists in Android 2.3.3. Our application does an OTA update and our users have been reporting strange behaviour, crashes and other weirdness after an update. We've now determined that this bug is the cause. The users launch the app directly from the installer (after an update) and then if they return to the home screen and relaunch the app by using a shortcut or from the list of applications we end up with multiple instances of our main activity (which is definitely a no-no).
This is very distressing as the problem has been around for a very long time and it seems that a lot of developers have lost a lot of time due to it.
It looks like the workaround in #21 will work for us.
This is very distressing as the problem has been around for a very long time and it seems that a lot of developers have lost a lot of time due to it.
It looks like the workaround in #21 will work for us.
dw...@acm.org <dw...@acm.org> #28
Perhaps we would get more attention to this problem if we changed the title. It actually has nothing to do with Eclipse. This is a real problem on real devices and affects all users, not just developers.
dw...@acm.org <dw...@acm.org> #29
This problem still exists in Android 4.0!
I have created a new issue 36941942 with the title "App launch fundamentally broken when app is launched via browser, market install or market update". I've attached source code, 2 APKs, step-by-step instructions, log files and screen shots that exactly describe the problem and how to reproduce it.
This bug is present on all Android versions. It happens when you launch the app from a development environment (Eclipse, IntelliJ, etc.), download from the web browser, install from the market, upgrade from the market, or install by using a file manager.
Please help get this issue resolved by making a comment to issue 36941942 and starring that one.
Thanks!
I have created a new
This bug is present on all Android versions. It happens when you launch the app from a development environment (Eclipse, IntelliJ, etc.), download from the web browser, install from the market, upgrade from the market, or install by using a file manager.
Please help get this issue resolved by making a comment to
Thanks!
do...@gmail.com <do...@gmail.com> #30
#21 doesn't seem to work on Android 4.0 and 2.3.4.
kr...@gmail.com <kr...@gmail.com> #31
#21 works for me non 2.3.4 (Samsung Galaxy SII)
mi...@gmail.com <mi...@gmail.com> #32
#21 works for me on Android 4.0.3. I'd really like to use this fix, but comment #30 says it doesn't work there on 4.0. Can anyone else verify that?
So it seems to me that just about every app written for Android either has this bug or has a hack in code to get around the bug, which is absurd when you think about it, especially since the discussion has been going on for three years.
I'd like to use #21, but I can only test it on 2.1, 2.2, 2.35, Fire, and 4.0.3. I'll report if they're working on there
Bottom line, is #21 the way to go?
Thanks
So it seems to me that just about every app written for Android either has this bug or has a hack in code to get around the bug, which is absurd when you think about it, especially since the discussion has been going on for three years.
I'd like to use #21, but I can only test it on 2.1, 2.2, 2.35, Fire, and 4.0.3. I'll report if they're working on there
Bottom line, is #21 the way to go?
Thanks
an...@koukaam.se <an...@koukaam.se> #33
This works for me on 1.6, 2.3.5, 3.2, 4.0.3:
In onCreate():
if (!isTaskRoot()) {
finish();
return;
}
Could anybody tell the drawback of this approach? Thanks!
In onCreate():
if (!isTaskRoot()) {
finish();
return;
}
Could anybody tell the drawback of this approach? Thanks!
ju...@gmail.com <ju...@gmail.com> #35
Wow, super pathetic that this is still not fixed.
This is really BROKEN AS HELL! Spent days on this, luckily I found this bug report.
Haven't tried the fix yet, I will do so now.
This is really BROKEN AS HELL! Spent days on this, luckily I found this bug report.
Haven't tried the fix yet, I will do so now.
ju...@gmail.com <ju...@gmail.com> #36
Fix from #21 didn't work quite right for me. It handles this wrong on (2.1 and 4.1.1 at least).
1) Start from launcher. Navigate to some child activity.
2) Start using Open button in Market/Play store app. Should return to child activity from 1) but doesn't.
#33 did work. Thanks!
1) Start from launcher. Navigate to some child activity.
2) Start using Open button in Market/Play store app. Should return to child activity from 1) but doesn't.
#33 did work. Thanks!
za...@gmail.com <za...@gmail.com> #37
[Comment deleted]
ka...@gmail.com <ka...@gmail.com> #38
MarketPlace launch is solved by google. but browser app launcher still there
This problem still exists on 4.2.1
This problem still exists on 4.2.1
mi...@gmail.com <mi...@gmail.com> #39
Depending on your code, #21 might not be sufficient. It detects a duplicate launch and properly finish()es the Activity ... however, just calling finish() does not stop the current method (onCreate most likely) from executing. And thus if you have extra code in your onCreate which takes some meaningful action, that code will still run.
Note that #33 includes both finish() followed immediately by a return to conclude execution of onCreate.
I combined these two at the top of my LauncherActivity.onCreate and it's working great:
if (!isTaskRoot()) {
Intent intent = getIntent();
String action = intent.getAction();
if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && action != null && action.equals(Intent.ACTION_MAIN)) {
finish();
return;
}
}
Note that #33 includes both finish() followed immediately by a return to conclude execution of onCreate.
I combined these two at the top of my LauncherActivity.onCreate and it's working great:
if (!isTaskRoot()) {
Intent intent = getIntent();
String action = intent.getAction();
if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && action != null && action.equals(Intent.ACTION_MAIN)) {
finish();
return;
}
}
mi...@gmail.com <mi...@gmail.com> #40
I too have lost a lot of time to this bug.
I found that if I take exactly the same APK and install it using "adb install", my app works correctly and as I expect.
However, if I (or my users) download the apk and install it from the Downloads, I find the behaviour described above, namely a new instance of my Activity being created on the stack when the user navigates to home and then back to the app via the launcher. This can be verified with "adb shell dumpsys activity <activity>"
I found that if I take exactly the same APK and install it using "adb install", my app works correctly and as I expect.
However, if I (or my users) download the apk and install it from the Downloads, I find the behaviour described above, namely a new instance of my Activity being created on the stack when the user navigates to home and then back to the app via the launcher. This can be verified with "adb shell dumpsys activity <activity>"
mi...@gmail.com <mi...@gmail.com> #41
Confirming problem is still present on 4.3, seen on Galaxy Nexus with stock firmware (maguro).
mi...@gmail.com <mi...@gmail.com> #42
[Comment deleted]
ve...@gmail.com <ve...@gmail.com> #43
The Problem still exists in 4.2 and galaxy s2 mobile....
Almost 1 month to fix this bug thanks for the help guys.
Almost 1 month to fix this bug thanks for the help guys.
jo...@gmail.com <jo...@gmail.com> #44
It's really sad that google still can't fix the problem. However the good news is all you need to do is add a dedicated launcher activity and it works great. Finally fixed this problem for my app after I wasted days on other solutions. https://github.com/cleverua/android_startup_activity
me...@gmail.com <me...@gmail.com> #45
#40 is the working solution.
I wish Google could spend some time to resolve existing bugs instead of just updating versions of Android.
I wish Google could spend some time to resolve existing bugs instead of just updating versions of Android.
en...@google.com <en...@google.com>
si...@gmail.com <si...@gmail.com> #46
Reproduced on 4.4 too
al...@gmail.com <al...@gmail.com> #48
It works for me in my Asus 4.4. Thnks
gp...@gmail.com <gp...@gmail.com> #49
Any fix for this issue? I'm wasting my time on the same issue..
xa...@gmail.com <xa...@gmail.com> #50
i also see the same issue from Monkey. it keeps instance my Entry activity multiple times. the issue seems because we first start our activity by 'am start -f 0x10200000 -n com.xx.xxx/.StartupActivity'... we did not specify '-a android.intent.action.MAIN -c android.intent.category.LAUNCHER ' parameter. after apply the parameter, it works as expect.
i do not understand why the parameter for first start is that important.
i do not understand why the parameter for first start is that important.
yu...@gmail.com <yu...@gmail.com> #52
android M still got this issue . when I install a new apk from file Manager, and launcher it from install finish Activity.
I think this launcher is different from Home screen. so got this problem...
I think this launcher is different from Home screen. so got this problem...
dw...@sharpmind.de <dw...@sharpmind.de> #53
Still broken in Android 7 :-(
vs...@gmail.com <vs...@gmail.com> #54
Good Afternoon,
My issues is
1.When i open and and went to some activity.
2.then i click home button,then it go to background task.
3.when it click lauch icon .app is not resumed activity. it starts from Splash activity.
This is only occurs in released App not debug app.debug app working well,
I tried launchmode="singleInstance" or "SingleTop" what else..i tired all posibilities..other than any reply to me.
Regards,
Srinivas
My issues is
1.When i open and and went to some activity.
2.then i click home button,then it go to background task.
3.when it click lauch icon .app is not resumed activity. it starts from Splash activity.
This is only occurs in released App not debug app.debug app working well,
I tried launchmode="singleInstance" or "SingleTop" what else..i tired all posibilities..other than any reply to me.
Regards,
Srinivas
an...@gmail.com <an...@gmail.com> #55
I still got this issue.
[Deleted User] <[Deleted User]> #56
Unfortunately this issue and the related issue
To best illustrate the problem, we've published the following sample project:
The app can also be found on Google Play:
The behavior can be observed in this YouTube video:
in...@bigredzebra.com <in...@bigredzebra.com> #57
I already opened a new issue for this problem (which has still not been resolved, but is still open) here: https://issuetracker.google.com/issues/64108432
ga...@gmail.com <ga...@gmail.com> #58
Still open guys, framework people, you suck.
mk...@gmail.com <mk...@gmail.com> #59
I'm facing this issue on api 32.
After searching for solution since last 2 hours, I came here.
Sad to see it still open.
After searching for solution since last 2 hours, I came here.
Sad to see it still open.
st...@gmail.com <st...@gmail.com> #60
Comment has been deleted.
sh...@gmail.com <sh...@gmail.com> #61
if you are using 'FLAG_ACTIVITY_NEW_TASK', then change it to 'FLAG_ACTIVITY_CLEAR_TOP'. Hope this resolves the issue.
go...@gmail.com <go...@gmail.com> #62
#21 It perfectly works on android 14 But one thing you can mention this snippet in not splash or launcher activity , you should mention in your home activity , it will work better
Description
this menu item launches a new Activity that provides the help screen. The
code that launches this new Activity is
String packageName = HelpActivity.class.getPackage().getName();
String packageAndClassName = HelpActivity.class.getName();
Intent intent = new Intent().setClassName(packageName,
packageAndClassName);
startActivity(intent);
Steps to reproduce:
Run app from Eclipse
(App is launched on the phone)
Click the menu item
(The help Activity appears)
Press the HOME key
Start app again from the icon on the home screen
RESULTS
First run of this scenario:
The main Activity appears. Pressing the BACK key shows the help activity.
Pressing BACK again quits the app and returns to the home screen.
Subsequent runs of this scenario:
The help Activity appears. Pressing the BACK key shows the main activity.
Pressing BACK again quits the app and returns to the home screen.
This only happens when launching the app from Eclipse. This incorrect
behavior on the first run is not observed if I export an apk from Eclipse,
sign it, and install it on the phone with "adb install Some.apk".