It may not be what you are seeing, but on my phone, something like this happens because sleep mode is always in one orientation, and if the app was in the other one it gets killed and recreated in the sleep orientation... rather suboptimal if you ask me It sounds to me like you may not have things such as your startup sound tied to sufficiently specific causes. What happens if you rotate the phone while it's "on"? At any rate, you should be able to detect that the screen is not on and not do (or defer) a real startup If an implicit orientation change is the culprit, you can change how your application is treated with these - set things to claim your application can change on the fly instead of having to be recreated.
It may not be what you are seeing, but on my phone, something like this happens because sleep mode is always in one orientation, and if the app was in the other one it gets killed and recreated in the sleep orientation... rather suboptimal if you ask me. It sounds to me like you may not have things such as your startup sound tied to sufficiently specific causes. What happens if you rotate the phone while it's "on"?
At any rate, you should be able to detect that the screen is not on and not do (or defer) a real startup. If an implicit orientation change is the culprit, you can change how your application is treated with these - set things to claim your application can change on the fly instead of having to be recreated.
I think Chris Stratton is correct here. You might also find a bit more information on how to deal with this in this related question: stackoverflow. Com/questions/456211/… – Nailuj Nov 28 '10 at 17:05 The app is locked to landscape mode.
Changing the orientation while it is running has no effect. But I can see how android might be trying to restart it into portrait mode during sleep. Time to go hunting for routines that can tell me whether the screen is on or off.
– dwrussell2 Nov 28 '10 at 17:35 You might want to try watching logcat while the screen goes to sleep, if you have a unix-like development machine you can do something like adb logcat | tee logfile and go back and look later. If it's doing the sleep orientation thing, you'll see this in the logfile – Chris Stratton Nov 28 '10 at 17:45 Yup, looking at the logcat. I see a 'config changed' go through, and soon after onStop is called in my app killing it.
How lame. If the phone goes to sleep during the app, I get killed... I don't get to go onPause and onResume like everyone else, I have to start from scratch (I tried overriding all the shutdown functions and ignoring the super in this case, but it just crashes). I'll find someway to code around this.
– dwrussell2 Nov 28 '10 at 18:13 If you set things up so that you say you handle orientation changes in the running app, you shouldn't be killed and recreated any more. – Chris Stratton Nov 28 '10 at 18:28.
I'm seeing some interesting activity flow when android turns off the screen and locks the screen... my app goes through the regular flow, onCreate, onStart and onResume. Then, I let my phone sit there. When the screen goes black, onPause is called.
Then 5 seconds later, the app is killed (onStop, onDestroy). That's fine too. But immediately after onDestroy is called, onCreate, onStart and onResume are called, restarting the app even though the screen is blank.
The app has a load time, and it plays a sound when it starts, so it's kind of creepy when the phone you set down 30 seconds ago starts playing sounds. Why does android kill the app then restart it? Target is 2.1-update, and the phone is a Samsung Captivate.
Anyone else seeing this, and know a way to stop it?
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.