With the updates in iOS 14, there is a green dot that appears in the top corner when the camera is in use. My app sometimes uses the camera for AR, but it isn't needed for other aspects of the app. I'd like to make the green dot go away while the camera isn't needed so users don't think we're doing something with the camera in the background, but I can't seem to find a way to programmatically stop using the camera. Is there a way to do this?
-
1`self.captureSession?.stopRunning()` – aheze Oct 29 '20 at 20:07
-
I'm under the impression that the camera indicator has to be on no matter what, even if you are only using it for AR since you are using the camera. You can probably make a note of it so the users know that you are only using the camera for AR. Actually, that should already be there when you ask users permission to use the camera. – Cyril Oct 29 '20 at 21:27
1 Answers
It sounds strange – you're using AR app but do not need an AR camera. I suppose you understand that RGB sensor (as well as IMU sensors) must be active during the time when ARSession is running. ARSession is based on data coming from RGB sensor. So if you turn it off – nothing good happens.
At first let's discuss how to start and stop AR tracking. You can start running ARSession using standard ARKit procedure:
let config = ARWorldTrackingConfiguration()
sceneView.session.run(config, options: someOptions)
...and you can stop running ARSession using:
sceneView.session.pause()
After stopping ARSession, a heavy CPU/GPU processing and enormous battery energy consuming will be eliminated. However, if a session was stopped, next time you'll run it, it must begin tracking from scratch.
Solution
So the best solution in this case is to use a pre-saved scene data stored in ARWorldMap. Just track a surrounding environment, save ARWorldMap, and then stop running session. Then do whatever you want (with no active ARSession), and after it run a session again and just load ARWorldMap data. Simple.

- 49,178
- 17
- 136
- 220