Timer Slows down in sleep mode
ok i am using an nstimer for my game, and i want the game to continue when it is in sleep mode. The game still runs in sleep mode but not @ normal speed, does anyone know how to fix this problem?
Unless you have a really good reason why your game should be running in sleep mode, you really shouldn't. That's the whole purpose of sleep mode!
Imagine the face on your users when they see that their iPhone's battery has been drained because of your game. They'll quickly remove it and never play it again.
Imagine the face on your users when they see that their iPhone's battery has been drained because of your game. They'll quickly remove it and never play it again.
"When you dream, there are no rules..."
I do have a good reason: it us going to be part of the game, and I am going to notify the user
so please help
so please help
notify the users of what? Your notifications will not serve of anything when the device is put to sleep. I recommend checking your game design again, because what you're trying to do is not good.
"When you dream, there are no rules..."
This is in strong contrast to the Human Interface Guidelines for mobile development. I doubt Apple would allow a game that functions like this.
i want the games timer to keep going because thats how i keep score and if it turns that off it will be screwed up
chrism Wrote:i want the games timer to keep going because thats how i keep score and if it turns that off it will be screwed up
Your app is not suppose to keep running while in sleep mode, please read the HIG
I know there is a way to stop sleep mode, but does it stop sleep mode even when you press the sleep button?
chrism Wrote:I know there is a way to stop sleep mode, but does it stop sleep mode even when you press the sleep button?
You can set the idle timer so the phone does not automatically sleep for 10 minutes but you can not override the hardware switch.
Thanks you were a big help. Oh and sorry for me being so hard headed sometimes
a) your program wont be scheduled to run when the phone is sleeping.
b) save a time snapshot when the phone goes to sleep, and read the time when awaken. Do your update then and there. User happy, peace on earth...
b) save a time snapshot when the phone goes to sleep, and read the time when awaken. Do your update then and there. User happy, peace on earth...
Great idea can you tell me the kind of code I will need so I can check documentation
Thanks
Thanks
Check UIApplication's delegate methods and you will know where to place the code
"When you dream, there are no rules..."
Your application does run, at the same speed, while the phone is sleeping.
I imagine, because you are writing a game, you chose the OpenGL ES Template. This template has code that slows down the timer to 5 times per second when the application is no longer active - like when a phone call comes in or the phone goes to sleep.
I imagine, because you are writing a game, you chose the OpenGL ES Template. This template has code that slows down the timer to 5 times per second when the application is no longer active - like when a phone call comes in or the phone goes to sleep.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Timer and Touch Event concurrent issue | claudie | 7 | 3,873 |
Aug 9, 2009 06:05 PM Last Post: claudie |
|
| Sleep Mode never interrupting my game | Madrayken | 4 | 2,500 |
Jul 13, 2009 07:17 AM Last Post: Madrayken |
|
| Sleep mode | kendric | 2 | 2,211 |
Jul 2, 2009 12:18 PM Last Post: kendric |
|
| iphone watchdog timer | macnib | 5 | 3,566 |
May 10, 2009 10:58 PM Last Post: kodex |
|
| game slows down | crystal | 3 | 2,213 |
Feb 20, 2009 12:46 PM Last Post: longjumper |
|

