Check VPS availability at the device's current location

The Geospatial API uses a combination of VPS and GPS data to generate high-accuracy Geospatial transforms. The API can be used in any place where the device is able to determine its location:

  • In areas with low GPS accuracy, such as indoor spaces and dense urban environments, the API will rely on VPS coverage to generate high-accuracy transforms.
  • In outdoor environments with few or no overhead obstructions, the Geospatial API may be able to use available GPS location data to generate Geospatial transforms with high accuracy.

You can determine VPS availability at a given horizontal position before the AR session starts and use it to create more specific experiences — for example, to present an "Enter AR" button only when VPS is available.

Enable the ARCore API

Your app must enable the ARCore API to check VPS availability.

Check VPS availability in your app

The Geospatial API can be used in any place where the device is able to determine its location. If your AR experience hinges on VPS coverage, you can use GARSession#checkVPSAvailabilityAtCoordinate:completionHandler: to obtain a GARVPSAvailabilityFuture, an asynchronous task that checks the VPS availability at a given horizontal position. Once you have the GARVPSAvailabilityFuture, you can obtain its result by polling or through a callback.

Poll the result

Use GARFuture.state to obtain the state of the Future. There are three different states:

  • GARFutureStatePending: The operation is not yet complete, so no result is known.
  • GARFutureStateCancelled: The operation has been cancelled by GARFuture#cancel. Any registered callback will never be called.
  • GARFutureStateDone: The operation is complete. Use GARVPSAvailabilityFuture.result to obtain the result.

You may continue checking GARFuture.state until the task is complete.

Obtain the result through a callback

You can also obtain the result of a Future through a callback. Use GARSession#checkVPSAvailabilityAtCoordinate:completionHandler: and supply a completionHandler. This completionHandler will be called on the Main thread soon after the Future has state GARFutureStateDone.

Cancel the Future

Use GARFuture#cancel to attempt to cancel the Future. Due to thread parallelism, it may be possible that your cancel attempt does not actually succeed. GARFuture#cancel returns YES if this attempt was successful, and NO otherwise.

Use the Geospatial API without VPS coverage

The Geospatial API can also be used in areas that do not have VPS coverage. In outdoor environments with few or no overhead obstructions, GPS may be sufficient to generate a pose with high accuracy.

What's next