Hi I have an app that reads data from the accelerometer. However after the screen gets locked this not possible.
I have tried the following
-(void)startMonitoring{
UIApplication *thisApp = [UIApplication sharedApplication];
thisApp.idleTimerDisabled = YES;
....
....
}
-(void)stopMonitoring{
UIApplication *thisApp = [UIApplication sharedApplication];
thisApp.idleTimerDisabled = NO;
....
....
}
How can I keep reading from the accelerometer even after the screen gets locked. 开发者_高级运维
as I understand you, you don't want to disable screen locking in general by using:
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
There is a code sample at github.com playing a sound every x seconds even if the device is in standby mode:
http://github.com/marcop/MMPDeepSleepPreventer
The author just uses a timer firing every few seconds. I haven't tried it out yet, but it should work according to forum posts.
Kay
精彩评论