C Specification

The xrUnshareAnchorANDROID function is defined as:

// Provided by XR_ANDROID_anchor_sharing_export
XrResult xrUnshareAnchorANDROID(
    XrSession                                   session,
    XrSpace                                     anchor);

Parameters

Parameter Descriptions
  • session is the XrSession that owns the anchor.

  • anchor is the XrSpace of the anchor to unshare.

Description

The xrUnshareAnchorANDROID function invalidates previously shared anchors. This means that future uses of the anchor sharing token obtained when xrShareAnchorANDROID was called must fail until the anchor is shared again via xrShareAnchorANDROID. The runtime must also invalidate previous imports of the anchor sharing token and must not set XR_SPACE_LOCATION_POSITION_TRACKED_BIT or XR_SPACE_LOCATION_ORIENTATION_TRACKED_BIT for the imported anchor’s XrSpace. This means that a previously imported anchor must stop tracking if the original anchor is unshared by its parent session.

The runtime must return XR_ERROR_ANCHOR_NOT_OWNED_BY_CALLER_ANDROID if the anchor is not owned by the same XrSession that is the parent of XrAnchorSharingInfoANDROID::anchor.

An anchor that is not unshared explicitly by calling xrUnshareAnchorANDROID must be implicitly unshared by the runtime when the anchor is destroyed via xrDestroySpace, or when the parent XrSession is destroyed, including when the application that shared the anchor quits.

Valid Usage (Implicit)
Return Codes
On success, this command returns
  • XR_SUCCESS

  • XR_SESSION_LOSS_PENDING

On failure, this command returns
  • XR_ERROR_FUNCTION_UNSUPPORTED

  • XR_ERROR_VALIDATION_FAILURE

  • XR_ERROR_RUNTIME_FAILURE

  • XR_ERROR_HANDLE_INVALID

  • XR_ERROR_INSTANCE_LOST

  • XR_ERROR_SESSION_LOST

  • XR_ERROR_OUT_OF_MEMORY

  • XR_ERROR_ANCHOR_NOT_OWNED_BY_CALLER_ANDROID

See Also

Document Notes

For more information, see the OpenXR Specification

This page is extracted from the OpenXR Specification. Fixes and changes should be made to the Specification, not directly.

Copyright 2014-2025 The Khronos Group Inc.