SpatialAnchorTransferManager.TryImportAnchorsAsync(IInputStream) SpatialAnchorTransferManager.TryImportAnchorsAsync(IInputStream) SpatialAnchorTransferManager.TryImportAnchorsAsync(IInputStream) SpatialAnchorTransferManager.TryImportAnchorsAsync(IInputStream) SpatialAnchorTransferManager.TryImportAnchorsAsync(IInputStream) Method

Definition

Imports a stream of spatial anchors that was previously exported from another device. This allows both devices to reason about the same locations in their users' surroundings.

public : static IAsyncOperation<IMapView<Platform::String, SpatialAnchor>> TryImportAnchorsAsync(IInputStream stream)
static IAsyncOperation<IMapView<winrt::hstring, SpatialAnchor>> TryImportAnchorsAsync(IInputStream stream) const;
public static IAsyncOperation<IReadOnlyDictionary<string, SpatialAnchor>> TryImportAnchorsAsync(IInputStream stream)
Public Shared Function TryImportAnchorsAsync(stream As IInputStream) As IAsyncOperation<IReadOnlyDictionary<string, SpatialAnchor>>(Of IMapView)
Windows.Perception.Spatial.SpatialAnchorTransferManager.tryImportAnchorsAsync(stream).done( /* Your success and error handlers */ );

Parameters

stream
IInputStream IInputStream IInputStream

The stream to import anchors from.

Returns

IAsyncOperation<IReadOnlyDictionary<string, SpatialAnchor>> IAsyncOperation<IReadOnlyDictionary<string, SpatialAnchor>> IAsyncOperation<IReadOnlyDictionary<string, SpatialAnchor>>

The operation that triggers once the import is complete, providing the imported anchors.

Additional features and requirements

Capabilities
spatialPerception

Remarks

You must first export the anchors on the source device using the TryExportAnchorsAsync method. It is then the app's responsibility to get the data in the stream to the other device through its own network channel.

This imports the anchors and their supporting data into the device's spatial understanding. An app should then use SpatialAnchorStore.TrySave if it needs to retain access to this anchor.

This method can yield null if the device has reached its limit of spatial anchors, or if the spatial understanding system times out during the import.