Related
I noticed a bug that allows you to switch to running apps that were left behind with the home button.
Prerequisites: HTC Messages widget on one of the main screens.
Steps to reproduce:
1. Open an application (like 'people') and exit out with the home button, not the back button.
2. Repeat step one if you want to add other apps.
3. Go to the HTC messages widget and tap it to open a message.
4. Select menu option "All messages".
5. Press the 'back' button. This will switch to another app instead of close the messages.
6. Repeat step 5 to close the app and move to the next one.
Further notes:
Some apps will continue to show up even if you press 'back' on them to exit out.
For example, "People", "System settings" and browser never closes. Camera app does close, but you have to leave it by pressing 'home'.
Works on generic 1.5.
android dosent close apps untill needed lol just hold the home button to open any program you have run recently lol
mancsoulja said:
android dosent close apps untill needed lol just hold the home button to open any program you have run recently lol
Click to expand...
Click to collapse
I didn't know that - it is not mentioned in the manual. Thanks for that useful tip. Looks like a useful shortcut back to where you were before.
But how do you close a programme rather than let it waste memory and battery in the background?
peterc10 said:
I didn't know that - it is not mentioned in the manual. Thanks for that useful tip. Looks like a useful shortcut back to where you were before.
But how do you close a programme rather than let it waste memory and battery in the background?
Click to expand...
Click to collapse
If android needs ram it will close apps as needed but you can always download a task manager from the marketplace, there are some good free ones, i suggest advanced task manager its what i use
It would be good to be able to actually get them to exit properly.
Especially so when you have 4 or 5 "All messages" apps that won't go.
The only use this bug has is to take you to apps that are actually running as opposed to your history.
It also takes you to screens that a task switcher can't do for you, like the last screen you see from your last phone call and the call history.
frankv100 said:
The only use this bug has is to take you to apps that are actually running as opposed to your history.
Click to expand...
Click to collapse
I don't see this as being a bug. The ability to be able to short cut to the 6 (I notice it is limited to 6) previously used apps by a long press on the home button is obviously something the designers have deliberately included. And to me it is a useful additional feature (now I have found it!).
It seems to be history rather than running apps you are looking at - I closed several of my running apps using Astro and yet they still subsequently appeared in the list.
I started to develope an application.
When I wanted to close the application I clicked on the home screen,
but the app is still playing in the background.
Than I tried to click on the "back" key, but nothing happend, so I've
created a key event listener for the 'back" key, and inside that
method I wrote finish();
Now my app is closing but I think it's still running in the
background, because when I go to "manage applications" I can still see
it in the "running" tab, and if I press it, I see I can click on the
"force close" to actually close the app.
What do I need to do in order to really close the app without leaving
it open (one way or another)?
Thanks, Yaniv
You does not need a Exit Button, because Android will close things up as needed.
Perhaps you should read this: click
Otherwise you can exit your app with System.exit(0) at the end of your
onDestroy() methode.
Yes, I do know that Android is closing unused apps, but I do want to put also an exit option.
And thanks, the System.exit(0) worked for me
How does that compare to having an Activity-extending class call finish() from the main UI thread?
Actually... now that I think about it... if you're going to call it, do you have to call finish() as the last thing you do before returning from onResume(), etc? Or is it literally a black void from which the calling thread is guaranteed to never return? If you look at the Javadocs, they merely say that calling it indicates that the Activity should be closed, with the result propagated back to the parent (if any).
I've gotten burned by Java enough times over the past 10 years to know it's dangerous to read more into Javadocs than they literally say, regardless of how commonsense and reasonable it might seem. Going by the Javadocs' literal wording, it would be perfectly reasonable for a call to finish() to simply mark the Activity as eligible for aggressive closure and recovery... then return from the call and have a trainwreck after it executes code in the following finally{} block, or between the point where you called finish() and the return from the end of the current method. It would be outrageous, make lots of developers mad, and cause huge problems... but technically not inconceivable... which is why traditionally, I end up following every call to finish() with throw new RuntimeException("WTF?!?");, just to be safe and guarantee that execution will never, ever continue beyond that point.
Hi!
I've found a strange Activity behavior while programming a game for Android (currently with API level 8)
Following Situation:
The Main Activity only consinsts of one View on which the Game Thread draws all the sprites and stuff. In the manifest I checked android:multiprocess="false" and android:launchMode="singleInstance" for the Main Activity, so that Android only creates one instance of this activity, so you always come back to your left game after pressing the home button and starting the app again. This works great, but if I turn off the screen WHILE in game, and the activity is active, and turning it back on, Android creates another instance of the game (the Main Activity), so it starts over again.
So my question is, what could I do to prevent this and have the same behavior as if switched back to Home Screen before turning off the screen?
(The testing device is a HTC Desire HD with Android Revolution HD 5.1.7, if this is necessary information for helpers )
I hope someone here can help me!
I think you will have to listen for the screen off intent and handle this situation very explicitly. Maybe make the pause screen come up and then when it turns back on have your activity check for instances of itself and then deal with it.
Do you use static activities?
From something awesome
Thanks for your answer
The ScreenOff/On Intents method would be easy, but how can I recover the old Activity in the new one?
The Activity should be static, cause of the manifest properties, or not?
Another idea: In the onPause() Method queck if it was Screen off (with the corresponding intent) and 'call' the home button
Is this possible? And how could I realize this?
There is a way to use adb to send the home key press. And you can run adb on the phone with getRuntime().exec("adb keyevent xx")
Where xx is the home button constant
From something awesome
Thanks for your help!
But I made it now a much easier way...
One single 'moveTaskToBack()' in the onPause and everything works perfect!
Nice. Its always best to assume that android will do nothing to manage your app and to just do everything very explicitly
From something awesome
Hi there,
wondering if there is a way to get the back-button finishing the app.
When i'm at contacts or writing an sms or surfing, i want to go back to desktop as fast as possible...but when i'm at contact/details, i have to press the back button 5-6 times to go back trough all the previous screen.
Is there a way/hack/app telling the back-button (have to be a hardware button) to end the tasks completly when holding it, for example?
THX THX
Press the home button? That will take you back to the desktop.
If you need to you can then use task manager to end the task.
Would be nice to see a hack/fix to add the back button to kill functionality though
IakobosJ said:
Press the home button? That will take you back to the desktop.
If you need to you can then use task manager to end the task.
Would be nice to see a hack/fix to add the back button to kill functionality though
Click to expand...
Click to collapse
I miss this from my oxygen rom'd desire
Pkplonker said:
I miss this from my oxygen rom'd desire
Click to expand...
Click to collapse
It's already in in MIUI and most probably will be also in CM7.
well the back button does kill apps.
if you start, say, the browser and press the home button, then enter task manager, the browser will still run. if you start the browser and press the back button and open the task manager, it will show that the browser is not running anymore (actually, the browser was a bad example, since after a little bit of browsing you'd have to push the back button quite a lot since its primary function is to go back). the same goes for many more apps, whatsapp, facebook, twitter, angry birds...
Pkplonker said:
I miss this from my oxygen rom'd desire
Click to expand...
Click to collapse
me too. adamG has apparently got a SGS2 though
Thinking about it, I would also like this functionality although it isn't so urgent for me. If more people show interest maybe I'll attempt it as my first android app For such a simple app my opinion is that it should be free and not packed with admob spam, but if another dev wants to attempt it that's their choice I guess.
My thoughts:
It should be quick to develop a simple app providing this functionality. Just have it bind to an event which fires when the back button is pressed long, and have it kill the app whichever is first in the foreground window Z-order (I'm fairly new to the Android API, so I use Win32 API terminology here for example only). The only complexity may be to make the event bound globally (in all apps), as opposed to only bound in the app itself - hopefully that doesn't require root! I guess it should be a background service which runs on boot, and perhaps a very simple gui app to control that service (in fact would there be anything to configure at all? What do you think?).
sl9 said:
Thinking about it, I would also like this functionality although it isn't so urgent for me. If more people show interest maybe I'll attempt it as my first android app For such a simple app my opinion is that it should be free and not packed with admob spam, but if another dev wants to attempt it that's their choice I guess.
My thoughts:
It should be quick to develop a simple app providing this functionality. Just have it bind to an event which fires when the back button is pressed long, and have it kill the app whichever is first in the foreground window Z-order (I'm fairly new to the Android API, so I use Win32 API terminology here for example only). The only complexity may be to make the event bound globally (in all apps), as opposed to only bound in the app itself - hopefully that doesn't require root! I guess it should be a background service which runs on boot, and perhaps a very simple gui app to control that service (in fact would there be anything to configure at all? What do you think?).
Click to expand...
Click to collapse
It would need to be in the framework of the rom, I think
Chef_Tony said:
well the back button does kill apps.
if you start, say, the browser and press the home button, then enter task manager, the browser will still run. if you start the browser and press the back button and open the task manager, it will show that the browser is not running anymore (actually, the browser was a bad example, since after a little bit of browsing you'd have to push the back button quite a lot since its primary function is to go back). the same goes for many more apps, whatsapp, facebook, twitter, angry birds...
Click to expand...
Click to collapse
Yeah it does, but you have to press and press and press...would be cool, if you can "hold down" the button for a sec and it will end the task.
Example...when i'm at handsentSMS > SMS > keyboard open...
Pressing BACK > close keyboard
Pressing BACK > closing SMS windows
Pressing BACK > closing handsentSMS
3 times pressing this button after every SMS suxx...sorry
Yeah i can press the HomeButton, but then its in my mind, that the app is running in background...isnt that bad at android-OS-structure, but its a bad feeling to me...
yes that's true. i was reading over your original post again and the first time through i must have overread the part where you named sms and the browser as examples. you are right, in that case, it does not work very well. an alternative way is to hold the home button, then press task manager and kill the app instantly. but that takes even longer. i guess your best option is to actually let it run in the background, if you want to get out of it fast.
pulser_g2 said:
It would need to be in the framework of the rom, I think
Click to expand...
Click to collapse
I suspected this may be the case, really hope it isn't but I understand the Android security model needs to enforce a certain level of isolation for each app in the VM I'll do some further reading of the documentation to find out for sure, since a simple non-root APK providing this functionality for users would be very welcome.
I'm too used to other less-secure API's (Win32) in which any app could basically do whatever it wanted to other apps and the OS; I guess thats why virus authors love Windows so much
yeah just for anyone not totally in the know, there is a difference in android between pressing the BACK button and HOME button to leave an app. using the back button to leave an app and go back to the home screen basically "kills" the app. it puts it in a state where it can readily be killed by the OS in an instant.
when just pressing HOME to leave an app, the app is technically backgrounded. the OS will keep it around longer or in a different fashion.
so backing out of apps with the back button is always the way to "exit" any app.
Hello there!
I would like to try it by myself, but unfortunately I cant. So, someone who tried the SDK, have you noticed changes in multitasking system?
Right now the only way to resume an app is using fast app switch. But I really dont like it. I rather just use the homescreen icon instead. Right now it relaunch the app.
Any changes on that? (oh please)
Thank you so much!
mikeeam said:
Hello there!
I would like to try it by myself, but unfortunately I cant. So, someone who tried the SDK, have you noticed changes in multitasking system?
Right now the only way to resume an app is using fast app switch. But I really dont like it. I rather just use the homescreen icon instead. Right now it relaunch the app.
Any changes on that? (oh please)
Thank you so much!
Click to expand...
Click to collapse
Windows Phone apps can never resume via the homescreen like iOS, due to the addition of the hardware OS back button.
To illustrate why; imagine you have an app that has start page and a settings menu. When a user goes to the settings menu, they can only go back to the start page by pressing the hardware back button (this is standard Metro design).
Now imagine a user opens the app, goes to the settings menu, then exists the app by pressing the Home button. They then do a few other tasks and then resume the app. They are now stuck in the settings menu and can't get back to the app start page; the back key will take them back to the WP8 Home screen (this is how the WP OS backstack works).
To get around this issue, Microsoft specify that starting the app from the front page always has to start a fresh instance, so the user can never get "stuck".
iOS has software back buttons on every page, so all apps can resume however you launch them. Android had the same problem with their back button (actually worse, as their backstack can be altered by the OS choosing to kill memory-intensive apps); to get around this, from ICS onwards Android apps are meant to have a software back button in the top-left, to go back within the application (hardware back key is still OS backstack).
Aphasaic2002 said:
Windows Phone apps can never resume via the homescreen like iOS, due to the addition of the hardware OS back button.
To illustrate why; imagine you have an app that has start page and a settings menu. When a user goes to the settings menu, they can only go back to the start page by pressing the hardware back button (this is standard Metro design).
Now imagine a user opens the app, goes to the settings menu, then exists the app by pressing the Home button. They then do a few other tasks and then resume the app. They are now stuck in the settings menu and can't get back to the app start page; the back key will take them back to the WP8 Home screen (this is how the WP OS backstack works).
To get around this issue, Microsoft specify that starting the app from the front page always has to start a fresh instance, so the user can never get "stuck".
iOS has software back buttons on every page, so all apps can resume however you launch them. Android had the same problem with their back button (actually worse, as their backstack can be altered by the OS choosing to kill memory-intensive apps); to get around this, from ICS onwards Android apps are meant to have a software back button in the top-left, to go back within the application (hardware back key is still OS backstack).
Click to expand...
Click to collapse
But it sucks so bad! They should review this. I hate to use the back button, and I hate to not resume the app. Using a common app, for example, WhatsApp. I was in a chat with someone. Then I hit Windows button and Im at start screen. Then I receive a message from the same person I just left the chat. What I do? I can open from the toast, can open from fast app switch (back button), or open from start screen icon.
If I open from toast, that will depend on what the app was meant to be. In WhatsApp it would take me to the chat, because of deep toast notification. But, right now, it needs to reload the whole app to open just the chat.
If I open from fast switch, it will resume the app right away. Nice. But in any other platform the message would be there waiting for you. Right now, in WP, it takes a lot to refresh the chat. You keep like 10 seconds staring at the screen waiting it. Its even faster to just reopen the whole app.
And if I open from start screen, its almost the same effect of toast, but it dont take me to the chat, but to the start screen of the app.
The point is, the fast switch is not helping that much. In fact, it would makes sense to change the fast switch to open when holding the Windows button instead of back button, and whenever an app is open, opening it from start screen icon just resume it. Actually, a lot of people doesnt even know, or even knowing, doesnt even use fast switch. Im not a common smartphone user, and even so I dont use fast switch.
For me, its the worse problem of platform. And I dont care about CE or NT if it works, but I care about it working at all. Doesnt make sense to put a whole computer in my pocket if it cant resume a single app.
i don't like the idea either to relaunch the app when you just have put it in background. then again, i also hope we will be able to close apps from the fast-appswitch-screen. and add an option to the gesture lovers out there: pinch out on homescreen to launch multitasking. or swipe from edge like w8. or anything like that. it would add to UI experience and would eliminate that 2-seconds-pause when pressing and holding down the backbutton.
Was the question not about Windows Phone 8?
Windows Phone 8 is supposed to behave differently, since true background processing is supposed to be enabled. I haven't played with the SDK yet, but I suspect that for non recompiled apps, things will behave as they do on Mango. But, I think that things changed to target WinRT and set to be able to run in the background will be able to resume right where you left off.
It wouldn't make sense for an app that is running and processing things in the background to restart when the tile is pressed.
It's been a while since I used Mango or wrote any apps for it. But, when an app is suspended, the dev has a specified amount of time to save the state.
That way when it is relaunched, the app can resume where it left off, by processing the saved state on launch. I thought with fast resume the app stayed in memory, but that was done through a registry hack and not directly made available by any carrier.
After doing some reading, the multi tasking enhancements might only add gps and voip to the currently supported background processing.
JVH3 said:
But it sucks so bad! They should review this. I hate to use the back button, and I hate to not resume the app. Using a common app, for example, WhatsApp. I was in a chat with someone. Then I hit Windows button and Im at start screen. Then I receive a message from the same person I just left the chat. What I do? I can open from the toast, can open from fast app switch (back button), or open from start screen icon.
If I open from toast, that will depend on what the app was meant to be. In WhatsApp it would take me to the chat, because of deep toast notification. But, right now, it needs to reload the whole app to open just the chat.
Click to expand...
Click to collapse
Tapping the toast to re-open the chat is the correct behavior here. I guess it's just bad coding that makes it take so long to resume; it should just be able to go straight to the conversation and skip all the "loading contacts...connecting" stuff.
JVH3 said:
Was the question not about Windows Phone 8?
Windows Phone 8 is supposed to behave differently, since true background processing is supposed to be enabled. I haven't played with the SDK yet, but I suspect that for non recompiled apps, things will behave as they do on Mango.
But, I think that things changed to target WinRT and set to be able to run in the background will be able to resume right where you left off.
Click to expand...
Click to collapse
Are you sure you're not thinking of Windows 8? For Windows Phone 8, no changes have been announced regarding multitasking or background tasks, *except* that a few select APIs (VOIP, location) will be able to run in the background, similar to iOS (not true backgrounding like Android)
Also we are talking about resuming, not background processing. In the WP8 SDK emulator, apps built into the OS don't resume; Therefore it's safe to assume 3rd party apps are not going to either.
JVH3 said:
It wouldn't make sense for an app that is running and processing things in the background to restart when the tile is pressed.
It's been a while since I used Mango or wrote any apps for it. But, when an app is suspended, the dev has a specified amount of time to save the state.
That way when it is relaunched, the app can resume where it left off, by processing the saved state on launch. I thought with fast resume the app stayed in memory, but that was done through a registry hack and not directly made available by any carrier.
Click to expand...
Click to collapse
When an app is closed the developer is meant to save the state, so that it can be reloaded if it is quick-resumed. However, once the app leaves the backstack (the 5 apps that appear in when you hold the back-button), this state is supposed to be discarded.
This is not a technical issue; it would be trivial for app developers to save the state and make their apps resume. The issue is that Microsoft's publishing guidelines (to get your app published on the WP app store) specifically says that an app launched from the home screen must launch showing it's introduction page, i.e. it can't resume. It could save some state, so a web-browser could still have all the recent tabs open, but it couldn't show the last one seen (ironically IE9 does resume it's state - guess Microsoft are allowed to break their own guidelines).
I agree it doesn't make sense to restart an app that is performing some background task; but then how to you avoid users getting stuck within a certain page, as in my example above? If WP8 includes a hardware back button, they can't change this policy.
Well, thats a shame. I hate reloading the app everytime I need it. Its so meaningless. I dont need VOIP, I dont need Skype running all the time. But I do need apps to be fast.
It really depends on how exactly the developers save their app state when the app is sent to background/tombstoned.
I, for one, use a text file to save data ( a lot of data) and proceed to loading the app as usual, and the moment the user presses a button, a pop up asks him weather he wants to restore or start anew.
I'm guessing that not every app will do this, as it is up to the developer to implement this.