Tries to cancel the execution of this operation. If the operation was cancelled by this
invocation, this method returnstrueand the associated callback (if any) will never be
invoked.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eHostCloudAnchorFuture\u003c/code\u003e handles asynchronous operations for hosting Cloud Anchors, initiated by \u003ccode\u003eSession.hostCloudAnchorAsync()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eProvides methods to check operation status (\u003ccode\u003egetState()\u003c/code\u003e), cancel hosting (\u003ccode\u003ecancel()\u003c/code\u003e), and retrieve results (ID and state).\u003c/p\u003e\n"],["\u003cp\u003eSuccessful hosting yields a Cloud Anchor ID (\u003ccode\u003egetResultCloudAnchorId()\u003c/code\u003e) and \u003ccode\u003eAnchor.CloudAnchorState.SUCCESS\u003c/code\u003e state.\u003c/p\u003e\n"],["\u003cp\u003eConsult the Cloud Anchors developer guide for detailed information on using this class for Cloud Anchor hosting.\u003c/p\u003e\n"]]],[],null,["# HostCloudAnchorFuture\n\n`\npublic class\n`**HostCloudAnchorFuture**`\n` \nHandle to an async operation launched by [Session.hostCloudAnchorAsync(Anchor, int, BiConsumer)](/ar/reference/java/com/google/ar/core/Session#hostCloudAnchorAsync(com.google.ar.core.Anchor,%20int,%20java.util.function.BiConsumer\u003cjava.lang.String,%20com.google.ar.core.Anchor.CloudAnchorState\u003e)). See the [Cloud Anchors\ndeveloper guide](https://developers.google.com/ar/develop/java/cloud-anchors/developer-guide) for more information. \n\nPublic Methods\n--------------\n\n|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` boolean ` | [cancel](/ar/reference/java/com/google/ar/core/HostCloudAnchorFuture#cancel())`()` Tries to cancel the execution of this operation. |\n| ` `[String](https://developer.android.com/reference/java/lang/String)` ` | [getResultCloudAnchorId](/ar/reference/java/com/google/ar/core/HostCloudAnchorFuture#getResultCloudAnchorId())`()` Returns the Cloud Anchor ID of the hosted anchor. |\n| ` `[Anchor.CloudAnchorState](/ar/reference/java/com/google/ar/core/Anchor.CloudAnchorState)` ` | [getResultCloudAnchorState](/ar/reference/java/com/google/ar/core/HostCloudAnchorFuture#getResultCloudAnchorState())`()` Returns the result status of the hosting operation, when [Future.getState()](/ar/reference/java/com/google/ar/core/Future#getState()) returns [FutureState.DONE](/ar/reference/java/com/google/ar/core/FutureState#DONE). |\n| ` `[FutureState](/ar/reference/java/com/google/ar/core/FutureState)` ` | [getState](/ar/reference/java/com/google/ar/core/HostCloudAnchorFuture#getState())`()` Get the current state of the future. |\n\nInherited Methods\n-----------------\n\nFrom `class\njava.lang.Object` \n\n|---------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|\n| ` `[Object](https://developer.android.com/reference/java/lang/Object)` ` | clone`()` |\n| ` boolean ` | equals`(`[Object](https://developer.android.com/reference/java/lang/Object)` arg0)` |\n| ` void ` | finalize`()` |\n| ` final `[Class](https://developer.android.com/reference/java/lang/Class)`\u003c?\u003e ` | getClass`()` |\n| ` int ` | hashCode`()` |\n| ` final void ` | notify`()` |\n| ` final void ` | notifyAll`()` |\n| ` `[String](https://developer.android.com/reference/java/lang/String)` ` | toString`()` |\n| ` final void ` | wait`(long arg0, int arg1)` |\n| ` final void ` | wait`(long arg0)` |\n| ` final void ` | wait`()` |\n\nFrom `interface\n`[com.google.ar.core.Future](/ar/reference/java/com/google/ar/core/Future) \n\n|---------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean ` | [cancel](/ar/reference/java/com/google/ar/core/Future#cancel())`()` Tries to cancel the execution of this operation. |\n| ` abstract `[FutureState](/ar/reference/java/com/google/ar/core/FutureState)` ` | [getState](/ar/reference/java/com/google/ar/core/Future#getState())`()` Get the current state of the future. |\n\nPublic Methods\n--------------\n\n#### public\nboolean\ncancel\n()\n\n### cancel\n\n```java\npublic boolean cancel()\n``` \nTries to cancel the execution of this operation. If the operation was cancelled by this\ninvocation, this method returns `true` and the associated callback (if any) will never be\ninvoked.\n\n#### public\n[String](https://developer.android.com/reference/java/lang/String)\ngetResultCloudAnchorId\n()\n\n### getResultCloudAnchorId\n\n```java\npublic String getResultCloudAnchorId()\n``` \nReturns the Cloud Anchor ID of the hosted anchor. The returned result is only valid when [Future.getState()](/ar/reference/java/com/google/ar/core/Future#getState()) returns [FutureState.DONE](/ar/reference/java/com/google/ar/core/FutureState#DONE) and [getResultCloudAnchorState()](/ar/reference/java/com/google/ar/core/HostCloudAnchorFuture#getResultCloudAnchorState())\nreturns [Anchor.CloudAnchorState.SUCCESS](/ar/reference/java/com/google/ar/core/Anchor.CloudAnchorState#SUCCESS).\n\n#### public\n[Anchor.CloudAnchorState](/ar/reference/java/com/google/ar/core/Anchor.CloudAnchorState)\ngetResultCloudAnchorState\n()\n\n### getResultCloudAnchorState\n\n```java\npublic Anchor.CloudAnchorState getResultCloudAnchorState()\n``` \nReturns the result status of the hosting operation, when [Future.getState()](/ar/reference/java/com/google/ar/core/Future#getState()) returns\n[FutureState.DONE](/ar/reference/java/com/google/ar/core/FutureState#DONE).\n\n#### public\n[FutureState](/ar/reference/java/com/google/ar/core/FutureState)\ngetState\n()\n\n### getState\n\n```java\npublic FutureState getState()\n``` \nGet the current state of the future."]]