/// </inheritdoc> public void StartSession(object context, object arScene) { this.context = context as Context; this.arFragment = arScene as ArFragment; if (this.spatialAnchorsSession == null) { CloudServices.Initialize(this.context); } this.spatialAnchorsSession = new CloudSpatialAnchorSession(); this.spatialAnchorsSession.Configuration.AccountKey = Constants.SpatialAnchorsAccountKey; this.spatialAnchorsSession.Configuration.AccountId = Constants.SpatialAnchorsAccountId; this.spatialAnchorsSession.Session = this.arFragment.ArSceneView.Session; this.spatialAnchorsSession.AnchorLocated += this.OnAnchorLocated; this.spatialAnchorsSession.LocateAnchorsCompleted += this.OnLocateAnchorsCompleted; this.spatialAnchorsSession.SessionUpdated += this.SessionUpdated; this.spatialAnchorsSession.TokenRequired += SpatialAnchorsSession_TokenRequired; this.spatialAnchorsSession.Error += (sender, e) => { SessionErrorEvent eventArgs = e?.Args; if (eventArgs == null) { return; } var message = $"{eventArgs.ErrorCode}: {eventArgs.ErrorMessage}"; ShowMessage(this, message); }; this.spatialAnchorsSession.Start(); this.Status = SpatialAnchorStatus.Iddle; this.arFragment.TapArPlane += OnTapArPlane; }
static AzureSpatialAnchorsManager() { CloudServices.Initialize(Android.App.Application.Context); }