The Geospatial API uses a combination of VPS and GPS data to generate high-accuracy Geospatial poses. 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 poses.
- In outdoor environments with few or no overhead obstructions, the Geospatial API may be able to use available GPS location data to generate Geospatial poses 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
AREarthManager.CheckVpsAvailability() to obtain a
VpsAvailabilityPromise, an asynchronous task that checks the VPS availability at a given horizontal position.
Once you have the
VpsAvailabilityPromise, you can obtain its result by polling.
Poll the result
VpsAvailabilityPromise.State to obtain the state of the
InterruptiblePromise. There are three different states:
Pending: The operation is not yet complete, so no result is known.
Cancelled: The operation has been cancelled by
VpsAvailabilityPromise.Cancel(). Any registered callback will never be called.
Done: The operation is complete. Use
VpsAvailabilityPromise.Resultto obtain the result.
You may continue checking
VpsAvailabilityPromise.Result until the task is complete.
VpsAvailabilityPromise.Cancel() to attempt to cancel the
InterruptiblePromise. Due to thread parallelism, it may be possible that your cancel attempt does not actually cancel the promise.
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.
- Obtain the device camera's Geospatial pose to determine the exact location of the user's device in the real world.