Actions to reproduce bug:
Install APK (doesn't matter from market or eclipse or via usb connection) (
Do some stuff i.e. set cities, start search.
Press HOME button.
Open application launcher menu.
Press Aviascanner icon.
In some cases (about 5%) system starts new clean copy of application without selected cities and other data. If you press BACK button you can see previous copy of app (so it works in one task).
This behavior can be watched on this devices:
Samsung Galaxy Tab 2 10.1 OS 4.0.4
Samsung Gt-s6500d OS 2.3.6
I can't reproduce it in HTC Wildfire S A510e.
Also you can look at the youtube video where bug is reproduced (sorry for bad quality and russian language but the bug is very uncommonly, it was very hard to catch it)
Assuming that Step #2 is triggered by clicking "Open" from the post-install screen, or by running the app from Eclipse, this is a long-standing issue with Android.
This question outlines some options: How to prevent multiple instances of an activity when it is launched with different intents
Related
I've faced the different behavior of my app while clicking its icon if it was already launched before.
If I install the app via Eclipse or apk manager, launch it, press home button and then launch the app again clicking the application icon - it will bring the first activity from stack to front.
If I install the same version from the Play Market and follow the same steps - the application is relaunched completely from the very beginning (splash screen activity).
Is there a difference between intents which are used to start the app in this two cases?
How can I simulate the Play Market behavior to ensure that everything is fine before the release?
Thanks in advance.
This sounds like its to do with the android lifecycle. Read more here:
http://developer.android.com/training/basics/activity-lifecycle/index.html
Your activity will go through different stages when it starts back up depending on if it has been completely destroyed or if it has just been stopped. Pressing the home button will only stop your app rather than completely destroying it. If you're phone is running out of resources android might destroy your app in order to free up the resources its using.
Running from eclipse will start your app from a brand new start up (The same as people will get when they install from the market). So if it works when you run it from eclipse. It should work when other people install it too.
I was studying some tutorials on Android programming and I realized that pressing the Home button on the emulator takes me tot he phones Desktop, but my sample that was running at the time only goes to the background and does not get destroyed. However, if I press the return button, the app is destroyed as well. So I am assuming there might be other apps running int he background as well, those which I am not aware of. Is there something in the android emulator resembling the task manager from windows, which shows what apps are currently running on the phone? I don't have a smartphone with me, but I remember seeing something like that on my friend's smartphone a few days ago. It wasn't an external app but was something built into the phone, I could access it by going to Settings or something.
Is there a task manager built into the android emulator, or is there any other way I can see such things through the SDK debugger?
Inside the settings, there is a list of currently running processes.
First , Leaving the activity does not mean the process ends, It is just not invisible . When the Os needs more memory ,it will be recovered.
If you want to have a backup process, you can start a back service.
http://developer.android.com/reference/android/app/Service.html
Here is how I end a process (only works on Android 4.0+).
Instead of pressing home, press recent and swipe away the process you want to end. Then press home (or back).
You can also use this to close those nasty apps that prevent you from closing them by not allowing back button to work on their main screens.
This is much quicker than having to go to settings, etc.
We have designed an hybrid app which is a bit heavy (9 MB). Problem is that at times, minimizing this app (home button) makes the app reset in background i.e. its app cache is lost and app reloads from splash screen. After minimizing we worked with other apps in tablet (Galaxy 800).
We saw this problem only if we tried to launch app from the icon in launcher. This problem did not happen when we tried to launch it from the minimized list(recent apps button).
This problem is not specific to the tab. It also happened in Galaxy 3 and Droid Razr also.
Any guidance?
Problem is that at times, minimizing this app (home button) makes the app reset in background i.e. its app cache is lost and app reloads from splash screen.
This is perfectly normal.
Computers, phones, and tablets do not have infinite RAM. Android's approach to this problem is to keep your process around for a while after the user has left it, but eventually Android will terminate your process to free up RAM for other applications and their processes. You can read more about the Android process model in the documentation.
It can be possible that ‘deep clean' option is enabled by mistake on your phone. What deep clean does is, whenever you minimize an app , it releases all the memory associated with that app, and hence when you again open that app, it will start as if it is new. To check the 'deep clean' option,
go to the
Developer options -> 'Don't keep activities' -> disable it
If it is not disable please disable it.
In my app when i press home button and open the app from menu or shortcut it returns in the same screen but the pid of the process is killed.
BUT
if i hold home button and choose my app from there it will resume normally
This problem is not happenig in all devices 2.2.1 and 2.3.5 samsung galaxy Ace
if is solved again ( i doubt i lost many hours searcing) please link the answer
Thanks in advance
EDIT
In 2.3.6 Samsung Nexus S doesn't happen.
You shouldn't worry about that. The whole Android ecosystem is built around the concept of never terminating your application yourself, and letting the OS handle that aspect of things, and it's working very well if your app is written following the good practices.
Make good use of the Activities lifecycle methods (onPause, onResume, onStop, etc.), and everything will work smoothly, whether your app has been effectively terminated or kept in the background by Android.
I'm feeling screwed up now after working on this problem for the last century. Thanks in advance for your help!
What Happened: I develop an app, which is a game that contains a game
activity that uses CountDownTimers for timed game rounds. Pausing,
exiting the app from this activity (via pressing the power button,
home button etc.) works fine when tested on my Samsung Galaxy Tab 7",
running the unsigned app from Eclipse before it has been signed.
Ecstatic that I've completed my work, I go ahead and sign the freaking apk in
CMD. I test the signed app just to check that it works fine by
copy+pasting the signed .apk into the SD card of the same Galaxy Tab
and then installing it after removing all the old data of the app run from
Eclipse but OF COURSE IT DOESN'T WORK.
Things going wrong include the activity not pausing when I press the
power button when the timed round is being run (after I power the device back on I discover that the timer has been running while the screen was powered off and is still running, and my pause game dialog is nowhere to be found), the activity being
closed when I press the home key (after I press the home key and open
the app again the app restarts from the introductory splash screen of
the app) and lastly, when I pause the game midway, power off and on
the screen, hit resume on the pause game dialog - the game timer goes from something like
18.42s straight to 0.00s and continues from there into the next activity.
Okay, so that is very much more of a story than a question about code - but here's the technical question - why is my signed app behaving differently from the unsigned one that was run from Eclipse? I'm not providing any code here of how i did those things, since that should be irrelevant considering that they work in the first place (as in by running the app on my device while developing in Eclipse).
So very nearly there... URGH
Not sure if this is actually your problem ... but the most common reason that a signed app does not work when the unsigned/Eclipse version does is that building the signed app generally includes a Proguard obfuscation/optimization step.
One of the consequences of Proguard optimization is that some of the classes/methods referenced in either your XML layouts or using reflection may no longer have the same name (or may have been optimized out altogether).
The easiest/fastest way to check is to look at the logcat trace - there'll be a ClassNotFoundException or MethodNotFoundException or somesuch.