Google is committed to advancing racial equity for Black communities. See how.

GoogleARCore.CrossPlatform.XPSession

Represents a cross-platform ARCore session.

Summary

Public static functions

CancelCloudAnchorAsyncTask(string cloudAnchorId)
void
Attempts to cancel a pending AsyncTask<CloudAnchorResult> initiated by a call to ResolveCloudAnchor(string).
CreateCloudAnchor(Anchor anchor)
AsyncTask< CloudAnchorResult >
Attempts to asynchronously host a new Cloud Anchor.
CreateCloudAnchor(UnityARUserAnchorComponent anchor)
AsyncTask< CloudAnchorResult >
(iOS only)Attempts to asynchronously host a new Cloud Anchor.
CreateCloudAnchor(GoogleARCore.Anchor anchor, int ttlDays)
GoogleARCore.AsyncTask< CloudAnchorResult >
Attempts to asynchronously create a new Cloud Anchor with a given lifetime in days, using the pose of the provided anchor .
CreateCloudAnchor(UnityARUserAnchorComponent anchor, int ttlDays)
GoogleARCore.AsyncTask< CloudAnchorResult >
(iOS only)Attempts to asynchronously create a new Cloud Anchor with a given lifetime in days, using the pose of the provided anchor .
EstimateFeatureMapQualityForHosting(Pose pose)
Estimates the quality of the visual feature points seen by ARCore in the preceding few seconds and visible from the provided camera pose .
ResolveCloudAnchor(string cloudAnchorId)
AsyncTask< CloudAnchorResult >
Attempts to asynchronously resolve a Cloud Anchor.
SetAuthToken(string authToken)
void
(iOS only)Set the token to use when authenticating with the ARCore Cloud Anchor service on the iOS platform.

Public static functions

CancelCloudAnchorAsyncTask

void CancelCloudAnchorAsyncTask(
  string cloudAnchorId
)

Attempts to cancel a pending AsyncTask<CloudAnchorResult> initiated by a call to ResolveCloudAnchor(string).

Any pending AsyncTasks associated with the given cloudAnchorId will complete with result: CloudServiceResponse.ErrorRequestCancelled and the CloudAnchorResult.Anchor will be null. If no operation is pending for the given cloudAnchorId , this call does not take effect and a warning message will be logged.

Details
Parameters
cloudAnchorId
The id of the Cloud Anchor that is being watched or resolved.

CreateCloudAnchor

AsyncTask< CloudAnchorResult > CreateCloudAnchor(
  Anchor anchor
)

Attempts to asynchronously host a new Cloud Anchor.

Details
Parameters
anchor
The anchor to host.
Returns
A task that will complete when the attempt to host a new Cloud Anchor has finished. The result will be a CloudAnchorResult associated with the operation.

CreateCloudAnchor

AsyncTask< CloudAnchorResult > CreateCloudAnchor(
  UnityARUserAnchorComponent anchor
)

(iOS only)Attempts to asynchronously host a new Cloud Anchor.

Details
Parameters
anchor
The anchor to host.
Returns
A task that will complete when the attempt to host a new Cloud Anchor has finished. The result will be a CloudAnchorResult associated with the operation.

CreateCloudAnchor

GoogleARCore.AsyncTask< CloudAnchorResult > CreateCloudAnchor(
  GoogleARCore.Anchor anchor,
  int ttlDays
)

Attempts to asynchronously create a new Cloud Anchor with a given lifetime in days, using the pose of the provided anchor .

The initial pose of the returned anchor will be set to the pose of the provided anchor . However, the returned anchor is completely independent of the original anchor , and the two poses might diverge over time. Hosting requires an active session for which the GoogleARCore.TrackingState is GoogleARCore.TrackingState.Tracking, as well as a working internet connection. The task will continue to retry silently in the background if it is unable to establish a connection to the ARCore Cloud Anchor service.

Details
Parameters
anchor
The anchor to host.
ttlDays
The lifetime of the anchor in days. Must be positive. The maximum allowed value is 1 if using an API Key to authenticate with the ARCore Cloud Anchor service, otherwise the maximum allowed value is 365.
Returns
A task that will complete when the attempt to create a new Cloud Anchor has finished. The result will be a CloudAnchorResult associated with the operation.

CreateCloudAnchor

GoogleARCore.AsyncTask< CloudAnchorResult > CreateCloudAnchor(
  UnityARUserAnchorComponent anchor,
  int ttlDays
)

(iOS only)Attempts to asynchronously create a new Cloud Anchor with a given lifetime in days, using the pose of the provided anchor .

The initial pose of the returned anchor will be set to the pose of the provided anchor . However, the returned anchor is completely independent of the original anchor , and the two poses might diverge over time. Hosting requires an active session for which the ARTrackingState is ARTrackingState.ARTrackingStateNormal, as well as a working internet connection. The task will continue to retry silently in the background if it is unable to establish a connection to the ARCore Cloud Anchor service.

Details
Parameters
anchor
The anchor to host.
ttlDays
The lifetime of the anchor in days. Must be positive. The maximum allowed value is 1 if using an API Key to authenticate with the ARCore Cloud Anchor service, otherwise the maximum allowed value is 365.
Returns
A task that will complete when the attempt to create a new Cloud Anchor has finished. The result will be a CloudAnchorResult associated with the operation.

EstimateFeatureMapQualityForHosting

FeatureMapQuality EstimateFeatureMapQualityForHosting(
  Pose pose
)

Estimates the quality of the visual feature points seen by ARCore in the preceding few seconds and visible from the provided camera pose .

Cloud Anchors hosted using higher quality features will generally result in easier and more accurately resolved Cloud Anchor poses. If feature map quality cannot be estimated for given pose , warning message will be logged and FeatureMapQuality.Insufficient is returned.

Details
Parameters
pose
The camera pose to use in estimating the quality.
Returns
The estimated feature map quality.

ResolveCloudAnchor

AsyncTask< CloudAnchorResult > ResolveCloudAnchor(
  string cloudAnchorId
)

Attempts to asynchronously resolve a Cloud Anchor.

You don't need to wait for a call to resolve a Cloud Anchor to complete before initiating another call. A session can have up to 20 Cloud Anchors and pending AsyncTasks at a given time. The task will continue to retry in the background indefinitely, until it is successfully resolved, cancelled, or reaches a terminal error state.

Details
Parameters
cloudAnchorId
The id of the Cloud Anchor to resolve.
Returns
A task that will complete when the attempt to resolve a Cloud Anchor has finished. The result will be a CloudAnchorResult associated with the operation.

SetAuthToken

void SetAuthToken(
  string authToken
)

(iOS only)Set the token to use when authenticating with the ARCore Cloud Anchor service on the iOS platform.

If an API Key was provided, the token will be ignored and an error will be logged. Otherwise, the most recent valid auth token passed in will be used. Call this method each time you refresh your token. Note: This can only be called after the ARCore session is created, and should be called each time the application's token is refreshed.

Details
Parameters
authToken
The token to use when authenticating with the ARCore Cloud Anchor service. This must be a nonempty ASCII string with no spaces or control characters. This will be used until another token is passed in. See documentation for supported token types.