# Location doesn't appear to be tracked after calling ARLocationManager.StartTracking() programmatically

**URL:** <https://community.nianticspatial.com/t/location-doesnt-appear-to-be-tracked-after-calling-arlocationmanager-starttracking-programmatically/5629>\
**Category:** I'm Stuck\
**Created:** [November 13, 2025, 7:31pm UTC](https://community.nianticspatial.com/t/location-doesnt-appear-to-be-tracked-after-calling-arlocationmanager-starttracking-programmatically/5629 "2025-11-13T19:31:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Moore](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@Michael\_Moore](https://community.nianticspatial.com/u/Michael_Moore)\
**Post date:** [November 13, 2025, 7:31pm UTC](https://community.nianticspatial.com/t/location-doesnt-appear-to-be-tracked-after-calling-arlocationmanager-starttracking-programmatically/5629/1 "2025-11-13T19:31:12Z")

</div>

_Include the following details (edit as applicable):_

- **Issue category** : ARDK Documentation / VPS / Scanning Framework
- **Device type & OS version** : Android
- **Host machine & OS version** : Windows 11 Version 10.0.26200 Build 26200
- **Issue Environment** : On Device
- **Xcode version** :
- **ARDK version** : 3.15.0-2508040839
- **Unity version** : 6000.0.53f1

Description of the issue:

_When I am physically at the VPS location I am attempting to track, I do not get a hit on the location_

I have loaded 2 VPS locations in the AR Location manager on the XR Origin (with AR Location set to none), and have successfully ran the Persistent AR Demo sample code in the past. My goal is to track these locations from code (and one day add the locations to the location manager in code as well), but I am having trouble with this.

Here is the code:

```csharp
// Wait for ARSession to be tracking
yield return new WaitUntil(() => ARSessionGuard.IsSessionTracking);

//Add event listener for when the tracking state of the location being tracked 
//changes
_arLocationManager.locationTrackingStateChanged += OnLocationTrackingStateChanged;

var arLocations = _arLocationManager.ARLocations;

Debug.Log($"[{DateTime.Now}] StartTracking: {arLocations[index].Payload.ToBase64()}");

_arLocationTrackingText.text = $"StartTracking: {arLocations[index].name}";

_arLocationManager.SetARLocations(arLocations[index]);
_arLocationManager.StartTracking();

```

After `_arLocationManager.StartTracking();` is called, I do not get any event handler calls telling me that tracking has started. My handler code is simple:

```csharp
private void OnLocationTrackingStateChanged(ARLocationTrackedEventArgs args)
{
            Debug.Log(
                $"Location Tracking State: {args.ARLocation}, {args.Tracking}, {args.TrackingConfidence}, {args.TrackingStateReason}");

}

```

Here’s what I have confirmed:

- I called `SetARLocations(...)` before `StartTracking()`as shown in the code above
- I subscribed to the event handler _before_ calling `StartTracking()`
- I confirmed `ARSession` is running before calling `SetARLocations(...)` and `StartTracking()`
- I confirmed location permissions are granted on the target
- I confirmed the correct event handler method name
- I confirmed that I am using a valid ARLocation to track. The same location works when it is selected in the Inspector before compiling, and in code I am just selecting the same location from the ARLocation array.
- I dump the debug out for the entire app to a text box on screen and do not see any error messages that would indicate a problem anywhere.

---

<div class="post-metadata">

**Author:** ![Maverick\_Niantic](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@Maverick\_Niantic](https://community.nianticspatial.com/u/Maverick_Niantic)\
**Post date:** [November 13, 2025, 9:19pm UTC](https://community.nianticspatial.com/t/location-doesnt-appear-to-be-tracked-after-calling-arlocationmanager-starttracking-programmatically/5629/2 "2025-11-13T21:19:38Z")

</div>

Hi Michael,

I’m happy to assist. With the `yield return`s in your code, make sure you call that function with `StartCoroutine`. A regular function call won’t work there. Can you share where the function is called?

Kind regards,  
Maverick L.

---

<div class="post-metadata">

**Author:** ![Michael\_Moore](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@Michael\_Moore](https://community.nianticspatial.com/u/Michael_Moore)\
**Post date:** [November 17, 2025, 12:07am UTC](https://community.nianticspatial.com/t/location-doesnt-appear-to-be-tracked-after-calling-arlocationmanager-starttracking-programmatically/5629/3 "2025-11-17T00:07:24Z")

</div>

Sure, it’s called here:

```auto
namespace AR
{
    public class PersistentAR : MonoBehaviour
    {

```

```auto
private void Start()
{
    //Start tracking location
    StartCoroutine(LoadNextLocation());
}

 }
}

```

---

<div class="post-metadata">

**Author:** ![Maverick\_Niantic](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@Maverick\_Niantic](https://community.nianticspatial.com/u/Maverick_Niantic)\
**Post date:** [December 15, 2025, 10:57pm UTC](https://community.nianticspatial.com/t/location-doesnt-appear-to-be-tracked-after-calling-arlocationmanager-starttracking-programmatically/5629/4 "2025-12-15T22:57:17Z")

</div>

Hi Michael,

Due to technical difficulties, my response to you never went through. I sincerely apologize for the delay.

Looks like this could be a race condition where the event handler is being registered too late for it to handle the event. I would recommend registering the event handler, i.e. placing the `_arLocationManager.locationTrackingStateChanged += OnLocationTrackingStateChanged` before your function yields.

Please give that a try and let me know how it goes!

Kind regards,  
Maverick L.

---

<div class="post-metadata">

**Author:** ![Michael\_Moore](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@Michael\_Moore](https://community.nianticspatial.com/u/Michael_Moore)\
**Post date:** [January 29, 2026, 12:49am UTC](https://community.nianticspatial.com/t/location-doesnt-appear-to-be-tracked-after-calling-arlocationmanager-starttracking-programmatically/5629/5 "2026-01-29T00:49:28Z")

</div>

Hi Maverick,

Thanks for the response. I’m circling back to this one and will keep you posted. Also: is there any sample code available for updating the VPS location being track through script or similar?

---

<div class="post-metadata">

**Author:** ![Maverick\_Niantic](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@Maverick\_Niantic](https://community.nianticspatial.com/u/Maverick_Niantic)\
**Post date:** [May 13, 2026, 9:00pm UTC](https://community.nianticspatial.com/t/location-doesnt-appear-to-be-tracked-after-calling-arlocationmanager-starttracking-programmatically/5629/6 "2026-05-13T21:00:42Z")

</div>


