Stay organized with collections Save and categorize content based on your preferences.
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:
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 APIYour app must enable the ARCore API to check VPS availability.
Once the ARCore API is enabled, you can check VPS availability without:
Session
(before calling Session.resume()
).GeospatialMode
.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 Session.checkVpsAvailabilityAsync()
to obtain a VpsAvailabilityFuture
, an asynchronous task that checks the VPS availability at a given horizontal position. Once you have the VpsAvailabilityFuture
, you can obtain its result by polling or through a callback.
Use Future.getState()
to obtain the state of the Future
. There are three different states:
PENDING
: The operation is not yet complete, so no result is known.CANCELLED
: The operation has been cancelled by Future.cancel()
. Any registered callback will never be called.DONE
: The operation is complete. Use VpsAvailabilityFuture.getResult()
to obtain the result.You may continue checking Future.getState()
until the task is complete.
// Obtain a VpsAvailabilityFuture and store it somewhere. VpsAvailabilityFuture future = session.checkVpsAvailabilityAsync(latitude, longitude, null); // Poll VpsAvailabilityFuture later, for example, in a render loop. if (future.getState() == FutureState.DONE) { switch (future.getResult()) { case AVAILABLE: // VPS is available at this location. break; case UNAVAILABLE: // VPS is unavailable at this location. break; case ERROR_NETWORK_CONNECTION: // The external service could not be reached due to a network connection error. break; // Handle other error states, e.g. ERROR_RESOURCE_EXHAUSTED, ERROR_INTERNAL, ... } }Kotlin
// Obtain a VpsAvailabilityFuture and store it somewhere. val future = session.checkVpsAvailabilityAsync(latitude, longitude, null) // Poll VpsAvailabilityFuture later, for example, in a render loop. if (future.state == FutureState.DONE) { when (future.result) { VpsAvailability.AVAILABLE -> { // VPS is available at this location. } VpsAvailability.UNAVAILABLE -> { // VPS is unavailable at this location. } VpsAvailability.ERROR_NETWORK_CONNECTION -> { // The external service could not be reached due to a network connection error. } else -> { TODO("Handle other error states, e.g. ERROR_RESOURCE_EXHAUSTED, ERROR_INTERNAL, ...") } } }Obtain the result through a callback
You can also obtain the result of a Future
through a callback. Use Session.checkVpsAvailabilityAsync()
and supply a callback
. This callback
will be called on the Main thread soon after the Future
has state DONE
.
session.checkVpsAvailabilityAsync( latitude, longitude, result -> { // Callback is called on the Main thread. switch (result) { // Handle the VpsAvailability result as shown above. // For example, show UI that enables your AR view. } });Kotlin
session.checkVpsAvailabilityAsync(latitude, longitude) { result -> // Callback is called on the Main thread. // Handle the VpsAvailability result as shown above. // For example, show UI that enables your AR view. TODO("Handle VpsAvailability " + result) }Cancel the
Future
Use Future.cancel()
to attempt to cancel the Future
. Due to thread parallelism, it may be possible that your cancel attempt does not actually succeed. Future.cancel()
returns true
if this attempt was successful, and false
otherwise.
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 nextExcept as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-14 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-14 UTC."],[[["The Geospatial API leverages VPS and GPS data to create precise AR experiences, adapting to environments with varying location accuracy."],["Developers can proactively check VPS availability before initiating AR sessions, enabling context-aware features like conditional AR activation buttons."],["The API offers flexible methods for obtaining VPS availability results, including polling and callbacks, accommodating different development approaches."],["Even without VPS coverage, the Geospatial API can function in outdoor settings with clear GPS signals, ensuring broader usability."],["After confirming VPS availability or suitable GPS conditions, developers can proceed to obtain the device's Geospatial pose and build immersive AR experiences grounded in real-world locations."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4