Can ARKit (or ARSession) keep running in the background?

My question is - Can

ARSession
run in the background - basically I need the ARKit running and all the per frame information and camera incentrics but I DONT want to render the camera feed on the screen - As happens in the
ARSCNView
.


Not specifically in the background thread or process.


Basically I just want to use the Tracking information(Images + Camera Pos + Camera Euler Angles etc) from the ARKit and dont want to render anything in AR per se or the camera feed.


Before everyone jumps on me - I know that Apple restricts GPU process in the background - case in point :

Execution of the command buffer was aborted due to an error during execution. Insufficient Permission (to submit GPU work from background) (IOAF code 6)

But there should be a way to use the

ARKit
or
ARSession
without the camera feed and only with the tracking information, right?

Replies

Yes you can run an ARSession without rendering the camera feed, just instantiate an ARSession, and run it with your preferred ARConfiguration. Here's a quick example:


var session: ARSession!


In viewDidLoad:


session = ARSession()


in viewDidAppear:


let configuration = ARWorldTrackingConfiguration()
session.run(configuration)
  • It will also run camera feed

Add a Comment