Reputation: 4905
How to detect camera / device idle time? In my current app, i show a camera view where-in augmented reality detection is happening using a third party framework. In a scenario, i want to detect camera view (launched using AVCaptureView class APIs) idle time, for ex: if the camera is moved to any direction, then i don't want to do any operation. If camera view is not moved within 10 secs, then i need to do some operation. I want to ask, Is there any generic approach to identify whether camera view (launched using AVCaptureView class APIs) or device is idle for some time ?
Thank you.
Upvotes: 0
Views: 187
Reputation: 4953
you can use the accelrometer to determive if there was any movement within the last seconds, if there was no considerable movement then the phone was idle
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{
if(acceleration.x > someValue || acceleration.y > someValue ||acceleration.z > someValue)
{
NSLog(@"you moved the phone");
}
}
Upvotes: 1