Keeping iOS from going to sleep

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Wild_Eep
Posts: 2
Joined: Sat Dec 10, 2011 7:20 am

Keeping iOS from going to sleep

Post by Wild_Eep » Sun Jan 15, 2012 9:50 pm

I'm writing an app that displays useful location-based information to the user continuously.

At the moment, after a certain interval, the iOS device goes to sleep.

I'd like the iOS device to remain awake while my app is running.

What is the best approach?

The only suggestion I've read so far is to play a sound every few minutes. Perhaps the sound file could contain silence. (As I write this, I'm thinking about the case where a user is playing music in the background. I wouldn't want to impact the music playback. I'll have to test this a bit.)

Are there any other approaches I should consider?

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4166
Joined: Sun Jan 07, 2007 9:12 pm

Re: Keeping iOS from going to sleep

Post by bn » Sun Jan 15, 2012 10:14 pm

Hi Eep,

have a look at

iphoneLockIdleTimer
iphoneUnlockIdleTimer


in the iOS Release Notes (p. 40 in version 5.0.2).

Kind regards

Bernd

JackD
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 28
Joined: Sat Mar 14, 2009 3:17 am

Re: Keeping iOS from going to sleep

Post by JackD » Mon Jan 16, 2012 10:26 pm

I've been working on a similar app that records a GPS path at a user-specified interval. I've had settings/auto-lock set to never, which I assume has the same effect as iPhoneLockIdleTimer. The problem with this is that the battery drains rapidly. A 4S lost 25% of its charge in 1 hour of recording yesterday. Is there a way to dim the screen to conserve power while the app still runs?
27" iMac, OS X 10.13
iPad 3, iPad Pro, iPhone 4s, iPhone 6, LG Optimus L9 phone, Samsung Galaxy Camera
LiveCode 8.1.9

Post Reply