开发者

Preventing sleep in Titanium for iPhone

开发者 https://www.devze.com 2022-12-15 19:12 出处:网络
I\'m trying to read the accelerometer for a longer period of time (betw开发者_如何学Ceen one and two hours).

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

精彩评论

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