Issue between app as the shortcut and app in the menu - android

I have a problem were I launch my app go to a different activity and press home. If I press the app again it starts with the activity I recently went to. However, this only works depending on where I originally launched the app. If I use the shortcut version of my app on the home screen and go to another activity then press home and then go to the app menu version where my app is located, I get sent to the main activity and not from the activity I recently went to. Is there any solutions to this?

Related

Launcher activity reopens when it is put into background and restored to foreground by clicking launcher right after installation process

An issue is about that a launcher activity reopens when it is put into background and restored to foreground by clicking launcher. This problem occurs only after first run when a user installs an app and launch it from a play store or an android package installer.
Here are steps to reproduce the issue:
The user installs the app from the play store or android package installer;
After installation the user opens the new installed app by clicking “OPEN” inside the play store app or the android package installer;
Inside the app the user goes to another activity and put the whole app into background by pressing a home button;
The user restored the app from background by clicking the app icon and new launcher activity is created.
In a result there are 3 activities instead of 2. Back stack looks like this:
Launcher activity;
Some other activity which was started by user inside the app;
Launcher activity.
Next, when the app is removed from a recent apps` list and above steps are performed again then the app behaves exactly as expected. New back stack looks like this:
Launcher activity;
Some other activity which was started by user inside the app.
I created example app to demonstrate the issue:
source code
Here is shown installation process and a first run from the android package installer:
first run
The user starts a SecondActivity inside of the app and puts app into background. Next, the user want to restore the app back to foreground and it turns out that a FirstActivity was created again.
Here is a back stack after above steps:
back stack after first run
Now, lets run the app in standard way:
normal run
Before this test the app was removed from recent apps` list. The user starts the SecondActivity inside of the app and puts it into background by pressing home button. Next, the user restores the app back to foreground and this time the user sees the SecondActivity. The app behaves as expected now.
Here is the back stack after above steps:
back stack after normal run
The issue doesn’t refer only to my example app. It can be verified using any app from the play store. I did such test on a Netflix app which was installed from the play store (btw. the Netflix home screen isn’t visible due to security policy):
netflix first run
Here are steps:
Install the Netflix app;
Open it from the play store;
Click “HELP” button on a main screen (inside the Netflix app);
Put app into background;
Click app icon;
The user sees again the main screen instead of a help screen. The back stack looks like this:
Main screen;
Help screen;
Main screen.
It can be verified by pressing back button then the user will see each screen one by one. As we can see the Netflix app behaves identical as my example app.
Can someone explain to my why does it happen?

History stack cleared when clicking on recent apps button

I'm working on a launcher app that basically launches other installed apps on the device with an explicit intent and I have a edge case scenario:
An Activity (Act) creates an intent of an application (App) and starts it by calling startActivity(intent).
App get launched, my Activity going to "stop" state.
After a while I want to get back to my application so I click on "back" hard button that closes App and bring my Application to foreground (resume state).
This is the wanted behaviour.
Here is the edge case:
If I click on the "recent applications" hard button (square icon) while on App is launched, history stack is lost, and when I return to App, and click on "back" hard button - App exists to the Launcher screen and onResume of my application is being called.
I searched the web for a solution for couple of hours now, maybe I'll find a solution here.
Thanks
It seems to me you should set android:alwaysRetainTaskState true in your root activity.

Home view is returned if I restore my app from apps icon android apk

When I run my apk directly in device without connecting the app to eclipse, and when I minimize my app such as pressing the home button -
if I press my app icon from opened app it will open the latest opened activity.
But if I press the icon of the app from app, the app run from the home activity.
I don't know the cause knowing that I don't override onpause or onstop or ondestroy method.
How can I resolve this issue?
Thank you

Android: Launch app from app installer will cause several instances?

1.install an apk from app installer
2.then just click "OPEN" to launch it at once
3.after the app launched and then press HOME key
4.find the app from app list and click its icon to launch again
5.then the app will be launched with a new instance.
And if you repeat 3~5 several times, it will repeat create a new instance. if you press "BACK" key now, you will see the app is still there for the same times you launched.
But if you just click "DONE" at step 2 and then launch the app from app list, everything will be OK then.
Why?
The app installer (as well as many Android IDEs) use different intent flags than the regular app launcher does, which means that the launcher's intent doesn't properly match with the Activity's existing intent and it ends up creating a new activity on top of the stack.
I think this question is similar to what you're asking about:
Activity stack ordering problem when launching application from Android app installer and from Home screen

Back button from my app goes to home screen rather than previous app

I'm trying to debug an issue and I'm not sure what is going on.
My application is launched from application A (this is not mine, someone else's, so I don't have any source code)
When I click the back button on my application, I land on the Android home screen rather than going to the application that launch me. I checked all the flags in the intent that I receive, and everything is turned off.
Now if I launch my application from any other application, then pressing the back button goes back to the application that launch me.
I'm not sure how to debug this issue. Any ideas?
Application A might call finish() once the Intent is sent to start your Activity. Then the Activity in application A that started the Intent to launch your Activity will go through onDestroy() and will be removed from the backstack, so when you press the back key you will go to the home screen if the Activity in Application A was the first Activity launched by Application A

Categories

Resources