---
updatedAt: 2025-11-11T02:47:44.000Z
agentTools:
  projectIndex: https://docs.webengage.com/llms.txt
---

# Advanced

## Location Tracking

WebEngage Xamarin.iOS SDK allows you to define location tracking accuracy, or to disable location tracking, which enables you to optimize for resources - device battery and data usage. Use `AutoTrackUserLocationWithAccuracy` to define location tracking accuracy as shown below. Note that this method is to be called after [WebEngage SDK initialization](xamarin-ios-getting-started#section-2-initialize-the-sdk).

```csharp
WebEngage.SharedInstance().AutoTrackUserLocationWithAccuracy(WEGLocationAccuracy.ForCity);
```

Following are the options that you can use to define location tracking accuracy.

<Table align={["left","left"]}>
  <thead>
    <tr>
      <th>

      </th>

      <th>

      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `WEGLocationAccuracy.Best`
      </td>

      <td>
        Uses the highest level of accuracy. Recommended for real-time location tracking, as it requires more time to determine location and consumes more device power.\
        Smallest displacement that can be measured: 1 km
      </td>
    </tr>

    <tr>
      <td>
        `WEGLocationAccuracy.ForCity`
      </td>

      <td>
        Recommended for city-level location tracking; consumes less device power.\
        Smallest displacement that can be measured: 20 km
      </td>
    </tr>

    <tr>
      <td>
        `WEGLocationAccuracy.ForCountry`
      </td>

      <td>
        Recommended for country-level location tracking; consumes less power.\
        Smallest displacement that can be measured: 100 km
      </td>
    </tr>

    <tr>
      <td>
        `WEGLocationAccuracy.Disable`
      </td>

      <td>
        Disables location tracking by WebEngage SDK. With this value, WebEngage will neither track any user location nor update it on your WebEngage dashboard.

        If you are using this configuration, you can manage location updates by using [`setUserLocationWithLatitude:andLongitude`](xamarin-ios-tracking-users#section-location) to manually set the location.
      </td>
    </tr>
  </tbody>
</Table>

> 🚧 Please Note
>
> 1. If `AutoTrackUserLocationWithAccuracy` is not called, then the SDK will track user location only if your app has permission to read the device location, with default accuracy `WEGLocationAccuracy.ForCity`.
>
> 2. Calling this method after initializing the SDK will force every launch of your app to track location with the given accuracy.
>
> 3. If your app does not have the permission to read device location, WebEngage SDK will not track any location irrespective of the configuration.

## Alternative Initialization

In order to initialize the SDK your app needs to call one of the below mentioned APIs, whichever is appropriate for the use case from your application's `AppDelegate`.

```csharp
bool autoRegister = true;
WebEngage.SharedInstance().Application(application, launchOptions, inAppNotificationDelegate, autoRegister);

WebEngage.SharedInstance().Application(application, launchOptions);

WebEngage.SharedInstance().Application(application, launchOptions, autoRegister);

WebEngage.SharedInstance().Application(application, launchOptions, notificationDelegate);
```

**Parameters**

1. `launchOptions`: `NSDictionary` passed into `application:didFinishLaunching:WithOptions` of your `AppDelegate`. You must pass the same dictionary in the above method calls.

2. `autoRegister`: If your application handles the APNs registration for remote notifications manually (or using some other SDK), set `autoRegister` to `false`. Default value for this is `true`, in which case WebEngage SDK will attempt to make the registration.

3. `notificationDelegate`: Must be an instance of a class which implements the `WEGInAppNotificationProtocol` for In-App notification lifecycle callbacks.

You are now ready to continue with the setup process [here](https://docs.webengage.com/docs/xamarin-ios-getting-started#section-3-configure-infoplist).