# Vps2Session Source: https://www.nianticspatial.com/docs/api/kotlin/com.nianticspatial.nsdk.vps2.Vps2Session/ Vps2Session > extends SessionBase A session for VPS2 localization. --- ## Declaration class Vps2Session --- ## Properties | Name | Type | Summary | | --- | --- | --- | | anchorPollingIntervalMs | Long | - | | anchorUpdates | Flow | Flow of anchor updates for all tracked anchors.Anchors are automatically added when created via [trackAnchor] or [createAnchor]. | | ardkHandle | Long | - | | debuggerEvents | Flow | Flow of VPS debugger events.Each emission is a single [VpsDebuggerDataEvent] from the latest delta batch.Events are emitted only when new ones are available. Enable logging via[Vps2Config.enableVpsDebugger] before starting the session. | | localizationPollingIntervalMs | Long | - | | localizationRequestRecords | Flow | Flow of localization request records.Each emission is a single [Vps2LocalizationRequestRecord] from the latest batch.Records are emitted only when new ones are available. | | localizationUpdates | Flow | Flow of the latest localization snapshot.This is useful for consumers that want to reactively drive UI or downstream computationswithout manually polling [getLatestLocalization]. | --- ## Functions | Name | Type | Summary | | --- | --- | --- | | anchorIdToString | String | Convert a VPS2 anchor id (32-byte ASCII hex) to a printable string. | | configure | void | Configure VPS2. Must be called while stopped. | | createAnchor | UUID | Create and start tracking an anchor at the specified pose. | | featureStatus | FeatureStatus | - | | getAnchorPayload | String? | Gets the payload data of a specified anchor.The payload encodes the data needed to localize an anchor across multiple devices or sessions.It can be shared or stored for later use with [trackAnchor]. | | getAnchorUpdate | AnchorUpdate | Gets the latest tracking update for a specified anchor. | | getAssetTrackingData | Vps2AssetTrackingData? | Gets the pose and tracking confidence of a VPS asset's origin in the device's AR tracking space.Call this regularly to place content authored in the asset's coordinate space: the pose isrefined as the device moves and VPS relocalizes.Tracking starts on demand and may take time to spin up, so keep polling.Data is only served while the asset is fully tracked -- no localization, limited, and lost allreturn `null`, and content should not be placed in any of those states. This is independent ofthe VPS2 tracking state, which describes the geolocation estimate: an asset with nogeoreference serves tracking data while the tracking state stays coarse.This function only accepts a VPS map asset ID, not a mesh or splat asset ID. | | getDeviceGeolocation | Vps2GeolocationData? | Get the geolocation of the device's last known camera pose. | | getLatestDebuggerEvents | List | Get VPS debugger events since the last call. | | getLatestLocalization | Vps2Localization | Gets the most recent VPS2 localization result.The returned localization contains the spatial mapping betweenthe device's AR coordinate space and real-world geolocation. | | getLatestLocalizationRequestRecords | List | Get diagnostic localization request records since the last call. | | getPose | Pose | Convert a geolocation to an AR pose using a localization snapshot.In most cases you want the overload that uses the latest localization automatically; usethis one only when a batch of geolocations must share a single snapshot. | | getTrackedAnchors | Set | Get the set of all tracked anchors. | | insertCustomDebuggerEvent | void | Insert a custom event into the VPS debugger log. | | localize | void | Requests localization to a site, identified by its site ID.Localizes against the site's production-deployed VPS assets and only those: an asset thathas not been deployed to production cannot be localized against. This is an asynchronousoperation: progress is reported on [localizationRequestRecords] as a record of type[Vps2LocalizationRequestType.ASSET_INFO] -- [Vps2LocalizationRequestStatus.PENDING] ondispatch, then [Vps2LocalizationRequestStatus.COMPLETED], or[Vps2LocalizationRequestStatus.FAILED] with the record's error set (e.g.[Vps2LocalizationError.SITE_NOT_FOUND] when no such site exists, or[Vps2LocalizationError.ASSETS_NOT_FOUND] when the site has nothing localizable in it).`COMPLETED` means every production-deployed asset in the site was submitted forlocalization, not that localization succeeded -- observe [localizationUpdates] for the outcome.Requests are additive: calling this again does not disturb a request already in flight,and the sites accumulate. Each request produces its own records, but the caller is notgiven its record identifier, so records from concurrent requests are distinguishableonly by the order in which they arrive.May be called before [start]; requests are deferred and dispatched in order when VPS2starts.Note: assets already submitted for localization remain in the localization set for thelifetime of the session. There is no way to stop localizing against a site once itsassets have been submitted, and no way to cancel a request in progress. Each additionalsite permanently increases the size of every cloud localization request and theper-frame target-selection cost, so keep the number of sites small. | | onDestroy | void | - | | onInit | void | - | | removeAnchor | void | Stop tracking an anchor. | | start | void | - | | stop | void | - | | trackAnchor | UUID | Start tracking an anchor specified by a base64 payload. | ---