Determining the location on iOS

AppMetrica can determine the location of a device. Location accuracy depends on the configuration that the library uses for initialization:

How to enable location determination

By default, the AppMetrica SDK is initialized with the enabled locationTracking option.

Note

AppMetrica SDK does not request the permission for getting location data. You should implement this using methods of the CLLocationManager class.

How to disable location determination

Alert

If the locationTracking option is disabled, AppMetrica determines the location by the IP address with accuracy to the country.

To initialize a library with locationTracking disabled, set the locationTracking property of the AppMetricaConfiguration configuration to NO:

// Creating an extended library configuration.
AMAAppMetricaConfiguration *configuration = [[AMAAppMetricaConfiguration alloc] initWithAPIKey:API_key];
// Disabling sending information about the device location.
configuration.locationTracking = NO;
// Initializing the AppMetrica SDK.
[AMAAppMetrica activateWithConfiguration:configuration];

To disable locationTracking after initializing the library, use the locationTrackingEnabled: property of the AppMetrica class:

[AMAAppMetrica locationTrackingEnabled:NO];

To initialize a library with locationTracking disabled, set the locationTracking property of the AppMetricaConfiguration configuration to false:

// Creating an extended library configuration.
let configuration = AppMetricaConfiguration.init(apiKey: "API key")
// Disabling sending  information about the location of the device.
configuration?.locationTracking = false
// Initializing the AppMetrica SDK.
AppMetrica.activate(with: configuration!)

To disable locationTracking after initializing the library, use the isLocationTrackingEnabled property of the AppMetrica class:

AppMetrica.isLocationTrackingEnabled(false)

If you didn't find the answer you were looking for, you can use the feedback form to submit your question. Please describe the problem in as much detail as possible. Attach a screenshot if possible.

Contact support