开发者

Preventing sleep in Titanium for iPhone

I'm trying to read the accelerometer for a longer period of time (betw开发者_如何学Ceen one and two hours).

However, when the iPhone goes to sleep and locks, the reading of the accelerometer readout is paused.

My setInterval timer seems to be running fine though. I can also play sounds.

I see two solutions

a) Find a way to read the accelerometer while locked b) Find a way to prevent the lock

I'm using Titanium with JavaScript.


In 0.9+ you can do the following:

Titanium.App.idleTimerDisabled = true;


See docs for [UIApplication sharedApplication].idleTimerDisabled = YES


Appcelerator will include this in version 0.9


If it's actually locking (and not just sleeping) that causes the lock: Settings -> General -> Auto-Lock -> Never

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜