GeospatialMode


class GeospatialMode : Config.ConfigMode


Feature that allows Geospatial localization and tracking. The Geospatial API uses a combination of Google's Visual Positioning System (VPS) and GPS to determine the geospatial pose.

The Geospatial API is able to provide the best user experience when it is able to generate high accuracy poses. However, the Geospatial API can be used anywhere, as long as the device is able to determine its location, even if the available location information has low accuracy.

  • In areas with VPS coverage, the Geospatial API is able to generate high accuracy poses. This can work even where GPS accuracy is low, such as dense urban environments. Under typical conditions, VPS can be expected to provide positional accuracy typically better than 5 meters and often around 1 meter, and a rotational accuracy of better than 5 degrees. Use Geospatial.checkVpsAvailability to determine if a given location has VPS coverage.

  • In outdoor environments with few or no overhead obstructions, GPS may be sufficient to generate high accuracy poses. GPS accuracy may be low in dense urban environments and indoors.

Note that setting this mode will consume additional runtime resources.

Summary

Public companion properties

GeospatialMode

The Geospatial API is disabled.

GeospatialMode

Geospatial tracking mode that uses only inertial measurement unit (IMU) and GPS data for localization.

GeospatialMode

The Geospatial API is enabled.

GeospatialMode

This property is deprecated. Use SPATIAL instead.

Public companion properties

DISABLED

val DISABLEDGeospatialMode

The Geospatial API is disabled. When GeospatialMode is disabled, current Anchor objects created from Geospatial will stop updating, and have their androidx.xr.runtime.TrackingState set to androidx.xr.runtime.TrackingState.STOPPED.

INERTIAL

val INERTIALGeospatialMode

Geospatial tracking mode that uses only inertial measurement unit (IMU) and GPS data for localization.

This mode provides a lower-power alternative to visual positioning systems, allowing the camera to be disabled when high precision is not strictly required.

Supported runtimes:

  • None

Required permissions:

SPATIAL

val SPATIALGeospatialMode

The Geospatial API is enabled. Geospatial should enter the running state shortly after this mode is set.

Using this mode requires your app do the following, depending on the Runtime:

On mobile and projected devices:

On mobile devices:

Location is tracked only while the Session is resumed.

On mobile devices, when the Geospatial API and the Depth API are enabled, output images from the Depth API will include terrain and building geometry when in a location with VPS coverage.

Not all devices support GeospatialMode.SPATIAL, use Config.ConfigMode.isSupported to check if the current device and selected camera support enabling this mode. These checks are done in the call to Session.configure.

Supported runtimes:

  • Play Services (on supported devices)

  • Projected

Required permissions:

VPS_AND_GPS

val VPS_AND_GPSGeospatialMode