iOS check if camera is obscured or not - ios

I need to check periodically if the camera is obscured or not.
I was thinking of doing this by taking pictures periodically and checking them for brightness, if there is any way to let an App take pictures while the App is in background. Apple does this within it's Find my iPhone system, as I've read (taking randomly/secretly photos of the thief). Is there any way of achieving this within an own App?
Or do you have any other idea how to achieve this?

Not in any way while your app is in the background. Here's a list of services allowed while the app is in the background.
You can only, sort of, check the luminosity while your app is active by calculating it from the images you take. Apple does not allow access to the light sensor to apps yet.

Related

How can I use ARKit while using Slide Over/Split Screen on iPadOS?

I have an app that uses ARKit to detect faces and send over the network the coordinates of interest, which works well. I would like this app to run in background, still sending the data over the network, while I would be using another app (almost) fullscreen.
The option 'Enable multiple windows' is activated in info.plist, but as soon as I launch my other app, the ARKit app stops sending information (the app actually probably stops).
Is there a simple way to do this, and at least is this feasible? Thanks!
This is not possible at this point. Camera and AR stuff is disabled at a system level in apps when they are displayed in Slide Over or Split View.
I'd recommend displaying a warning message when Slide Over/Split Screen is being used saying that you should use the app in full screen mode. See this answer under a different question for details.

How to use camera in background in iOS

I need to use the camera in background mode for continuous taking images.but as per apple documentation, we could not use the camera in background mode. Is there any alternate solution for fetching camera without opening application.My task is that When user clicked one button, app should be close and taking images continuously.Could you please any one guide me to do this task?
As the apple documentation say it, it's not possible:
Camera usage is prohibited while in the background.
And I don't think there is any way to do that.
It's good that apple doesn't allow because it increases risk of apps capturing your moments from background without making you notice. Thus risk to privacy.

GPS based VS Beacon based ranging? Which governs Lock screen left corner app icon

There are two approaches for showing an app/app suggestion (incase not installed) on the iphone lock screen / app switcher. One is GPS based, in which the IOS decides which app to show as a suggestion. Another is beacon based, in which a particular beacon is identified.
If location services are enabled for multiple apps and say all these apps are also using beacon based approach to show their icons on the lock screen left corner, which app icon will be shown by the IOS?
Since location services are enabled for these apps,and say there is another relevant app which is NOT using beacon based approach (using just the GPS based approach), can IOS give preference to beacon based apps over the GPS based this new app.?
For instance, Estimote’s NYC office is on the same block as an Equinox gym and our phones intelligently and automatically alert us to use that app. It’s super easy and intuitive to open the app while walking into the gym - and in the process, streamline the check-in flow with the gym’s front desk. However, because it solely uses GPS geofences, the accuracy is poor. We actually get the Equinox icon over 1 block away, and there is no control for the brands or stores (in this case Equinox) on how this appears.
Apple's suggestion of apps not installed on the phone based on proximity uses an undocumented technique. While I have verified it uses GPS as an input, I have never been able to confirm that beacons are used at all.
Regardless of whether beacons are used, because this is an undocumented feature, it is unlikely you will find a way to customize the behavior.
AFAIK, Apple has never shared the implementation details of how the lock screen icon AKA "suggested apps" feature works.
However, we did some experiments at Estimote and noticed that being inside a CLRegion (both the "GPS" CLCircularRegion, and CLBeaconRegion work) that an app monitors for via Core Location, consistently makes the app's icon show up on the lock screen. So it seems that both beacons and GPS location fall into the same mechanism that governs the location-based suggestions. (Note that in iOS 9, that's not just the lock screen icon, but also a bar at the bottom of the app switcher.)
Unfortunately, we weren't able to establish what happens if you're inside multiple qualifying CLRegions, belonging to different apps. We suspect it might have something to do with the order in which the apps register regions for monitoring, but were never able to get consistent results.
Furthermore, since this whole behavior is undocumented, Apple can change it at any time. Just something to be aware of.
Side note: handoff always trumps suggested apps.

iOS 7.1: Get Core Motion data (accelerometer, gyroscope) while app is in background

I am wondering how I can keep receiving motion sensor values while the app is in background mode. I realize that there are already several posts out there. For example, I have tried How Nike+ GPS on iPhone receives accelerometer updates in the background? which does not work for me.
I have also enabled background modes (location updates at the moment) in my App-Info.plist.
Are there any working examples out there? Also, if possible, I would not want to implement some of the hacks, e.g. play silent audio or get the user's location. Apps such as SleepCycle seem to be able to have achieved this without any workarounds.
I'd be grateful for any help.

Using camera on background (multitasking?) on ios 7

I want to make app as my master thesis on ios 7 but I need to know if could run camera on background. I need to record video after user press home button (it should be traffic cam to car while user uses another app eg. navigation). I know it was not possilbe in ios 6 but I know that ios 7 has better support for background tasks... Is it please possible? I would be grateful for every answer. Thank you
There is a list of long-running tasks permitted in the background in Apple's documentation.
Camera access is not one of them. You will need to have your app in the foreground to use the camera.

Resources