Reputation: 43
I tried out the sample project from Azure Spatial Anchors for android and everything worked. I can add an anchor from one smartphone and locate it from another smartphone. The problem is that I cannot locate the anchor after approximately 24h. I know that it is possible to set an expire date, but I did not and I haven't seen it in the code. Is there a time limit for storing the spatial anchors similar to ARCore Cloud Anchors?
Upvotes: 3
Views: 1650
Reputation: 381
It is possible to store spatial anchors for longer than 24 hours. The service doesn’t delete any of your anchor information unless you explicitly set the expiration time on the anchor or delete the anchor manually.
If you are currently using the sharing anchor sample, the original version of the sample was clearing your application storage every time.
if (!this.initializing.Wait(0))
{
this.initializing.Set();
await this.dbCache.DeleteIfExistsAsync(); // here the database gets deleted
await this.dbCache.CreateAsync();
this.initialized.Set();
}
This behavior was subsequently changed in a pull request.
Upvotes: 3
Reputation: 726
I haven't tried localizing anchors beyond the 24-hour limit. However, the expiration date can be setup as such:
// Set the expiry of the anchor to 24 hours so that we can play with
// the anchors for a day
CloudSpatialAnchor spatialAnchor = new CloudSpatialAnchor();
..
spatialAnchor.Expiration = DateTimeOffset.Now.AddDays(1); // Pass any Double value you want.
..
You could try setup one today and localize on sometime next week to check if anchors persist beyond 24 hours, even on a free tier. I'll do that too.
Upvotes: 0