I want my application to continue to work and interact with the user, even if the user presses the sleep button.
So far, I have learned that my application can stay alive with the following code:
NSTimer *timer = [NSTimer timerWithTimeInterval:0.5 target:self selector:@selector(timerFireMethod:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
It succeeds. The method
will be called every 0.5 seconds, even if I'm in sleep mode.- (void)timerFireMethod:(NSTimer*)theTimer
So I know what my problem is: how can I interact with my application in sleep mode? I just need a trigger to start playing a custom audio file. So I need a trigger event, something like detection:
-touch on the display
- accelerate activity
-a MotionShake event
But after receiving applicationWillResignActive-Event, none of the above work. My accelerometer stops the delivery of acceleration events. And I canβt start them again. The MotionShake event will not be delivered, and I do not know if you can catch the touch event during sleep.
Update
, , , 5 . - , .
, , , . Iphone , , ( ). , , 10 , iphone . , IPod , , . ?
---
- ?
Zensursula