Running IPhone apps while in sleep mode
Asked Answered
G

3

20

As of IPhone OS 3.0, MotionX GPS is able to keep recording a GPS track while in sleep mode. After you push the sleep button on top of the phone, the app continues receiving GPS coordinates and recording them. Does anyone know how they're able to do this? I'm only aware of the method to keep running audio while in sleep mode.

Grimsby answered 11/10, 2009 at 20:41 Comment(0)
G
18

I found a great webpage that explains how to do it -

Cached link from Wayback machine

Original Link, now 404

You have to start a timer that plays a sound every 10 seconds. But the sound can be silent.

Grimsby answered 11/10, 2009 at 23:11 Comment(3)
this is an cool trick, it solves a real problem, and it seems to work for me as well. i'm a little surprised that and app that used this technique would get approved for the app store though, this seems like the kind of thing that might get an app rejected.Pillion
Above link is dead.Sepaloid
Added a cached version of the link aboveHumanize
L
2

[UIApplication sharedApplication].idleTimerDisabled=YES should do it

Lotetgaronne answered 11/10, 2009 at 20:43 Comment(1)
THis works to prevent sleep from idleness, but doesn't work if they hit the lock button. MotionX is able to work after hitting the lock button, and it turns the screen off.Grimsby
U
1

I heard that the [UIApplication sharedApplication].idleTimerDisabled=YES will leave the screen's background light on, (after the user pressed the sleep button,) which will drain the battery.

But I have not tried this myself, so anybody with experiences correct this if it is wrong.

Undamped answered 18/9, 2010 at 21:51 Comment(1)
This stops the iphone from getting bored and locking on its own, but it does not prevent the user from physically pressing the sleep button and putting the device to sleep.Mefford

© 2022 - 2024 — McMap. All rights reserved.