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);
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<IMapView<winrt::hstring, SpatialAnchor const&>> TryImportAnchorsAsync(IInputStream const& stream);
/// [Windows.Foundation.Metadata.RemoteAsync]
/// [Windows.Foundation.Metadata.Deprecated("Use SpatialEntityStore instead of SpatialAnchorTransferManager. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 262144, "Windows.Foundation.UniversalApiContract")]
 static IAsyncOperation<IMapView<winrt::hstring, SpatialAnchor const&>> TryImportAnchorsAsync(IInputStream const& stream);
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<IReadOnlyDictionary<string,SpatialAnchor>> TryImportAnchorsAsync(IInputStream stream);
[Windows.Foundation.Metadata.RemoteAsync]
[Windows.Foundation.Metadata.Deprecated("Use SpatialEntityStore instead of SpatialAnchorTransferManager. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 262144, "Windows.Foundation.UniversalApiContract")]
public static IAsyncOperation<IReadOnlyDictionary<string,SpatialAnchor>> TryImportAnchorsAsync(IInputStream stream);
function tryImportAnchorsAsync(stream)
Public Shared Function TryImportAnchorsAsync (stream As IInputStream) As IAsyncOperation(Of IReadOnlyDictionary(Of String, SpatialAnchor))

Parameters

stream
IInputStream

The stream to import anchors from.

Returns

IAsyncOperation<IMapView<String,SpatialAnchor>>

IAsyncOperation<IReadOnlyDictionary<String,SpatialAnchor>>

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

Attributes

Windows requirements

App 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.

Applies to