Need help to increase the max lifetime for the cloud anchors

Hi boys!

I’m creating an AR app using cloud anchors. Everything works perfect, the anchors are hosted and resolved well. But they only remain alive 24h.

Reading documentation and searching in the code i have find this: “This is configurable up to 365 days when keyless authentication is used.” and “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”. which is certainly confusing for me as the app need the key to host the anchors in the cloud.

At this point i have many questions:

  • How it can be possible to host an anchor without key? I get an “unauthorized error” trying this.

  • How it is possible to increase the lifetime for the anchors? By code I get an error and “Google Cloud Platform” website is very very confusing and I can’t find anything but metrics.

Any help? Thanks in advance!!

Hey there! You might find this a good source of some useful info. :slight_smile:

Did you have any luck in enabling persistent anchors for longer than 24h?

I am running into the same issue.

The instructions posted here tell you you must use an API key:

“To use the ARCore Cloud Anchor API in your app, you’ll need an API Key.”

then on this page it states in the code comment:

“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.”

So you can host an anchor for up to 365 days, but you must authenticate with the API to host a cloud anchor, and also if you authenticate you can only host for 1 day.

Makes no sense. The app won’t even build with any setting other than API key authentication in ARCore config.

If you using Unity read this will help.

This is what I did

https://koolwin1.tistory.com/314

Is there any ideas sharing CloudAnchor Id between devices in Unity Engine?

I saw using Firebase to share id between devices but it’s in Android Studio.
https://codelabs.developers.google.com/codelabs/arcore-cloud-anchors?hl=en&continue=https%3A%2F%2Fcodelabs.developers.google.com%2F%3Fcat%3Dandroid%26%253Bhl%3Dzh-TW%26hl%3Dzh-TW#4

And I also saw CloudAnchorsManagement API but also using OAuth21 tool

CloudAnchorsManagement API
https://developers.google.com/ar/develop/platform-agnostic/cloud-anchors/management-api

OAuth21 tool
https://github.com/google/oauth2l

I used Unity 2020.3.2f1 to build an app.

Good guide, but there’s no need to turn multithreaded rendering off.

anyone here tried to place multiple ar objects and host it all at once ?

I did try to host 1 anchor with multiple objects at the same time. But it was not precise as I expected, so I decided to host multiple anchors. That works fine.