Reputation: 1105
I need to detect whenever another app is using the iPhone's/iPad's camera while my app is running. My app keeps on running in background (audio), but it does not use the camera itself. I just need to find out if another app is using any camera at all.
Moreover, I want to use as little CPU resources as possible to minimize battery usage.
I've tried without success:
AVCaptureSession
to catch interruption notifications (it's never notified)lockForConfiguration
on all AVCaptureDevice
senabled
property of AVCaptureInputPort
(it's always YES)connected
property of AVCaptureDevice
(it's always YES)For clarification:
Thanks for any pointers.
EDIT: this a security feature: I want to warn the user if there's a slight possibility that a malicious (foreground) app is taking a photo or video of the user or the surroundings while my app is in active (background) use.
Upvotes: 5
Views: 2237
Reputation: 11004
The iOS documentation doesn't say anything about a way your app can be notified when another app runs the camera. That doesn't sound like something Apple would ever allow either. Besides, it wouldn't do any good to know if another app is running the camera because: a) your app cannot use the camera if it's not active, and b) your app cannot affect the operation of another app in any way. Try to think of an alternative to what you're trying to achieve, because unfortunately, this way is impossible.
Upvotes: 3