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.

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

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

WEGLocationAccuracy.Best

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

WEGLocationAccuracy.ForCity

Recommended for city-level location tracking; consumes less device power.
Smallest displacement that can be measured: 20 km

WEGLocationAccuracy.ForCountry

Recommended for country-level location tracking; consumes less power.
Smallest displacement that can be measured: 100 km

WEGLocationAccuracy.Disable

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 to manually set the location.

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.

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.

Updated 2 months ago

Advanced


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.