Location Manager and Collection
This section of the SDK will guide you to efficiently manage and collect location information. We’ll delve into the core functionalities that facilitate precise location data collection and management within your application.
Required Permissions
Before starting tracking location using the Asset framework, you need to add the following required permissions in your Info.plist
file.
1<key>NSLocationWhenInUseUsageDescription</key>
2<string>[Your explanation here]</string>
3<key>NSLocationAlwaysUsageDescription</key>
4<string>[Your explanation here]</string>
5
6<key>UIBackgroundModes</key>
7<array>
8 <string>location</string>
9</array>
-
NSLocationWhenInUseUsageDescription: This permission requests access to your location when you're actively using it, allowing us to provide location-based services and features.
-
NSLocationAlwaysUsageDescription: This permission requests continuous access to your location, even when it's running in the background. It enables us to provide seamless location-based services and notifications, enhancing your overall app experience.
-
UIBackgroundModes: This Permission requests the ability to continue receiving location updates even when it's running in the background. This allows the app to provide location-based services and features that require ongoing location tracking
Tracking Mode
Location Tracking Mode determines how frequently and accurately the location updates are obtained during tracking. There are three different tracking modes available:
Tracking Mode | Accuracy | Distance interval | Description |
---|---|---|---|
ACTIVE | High | 5m | This mode is suitable for applications that require precise and real-time location updates. It provides high accuracy at the cost of increased battery usage. |
BALANCED | Medium | 20m | This mode strikes a balance between accuracy and battery usage. It provides moderately accurate location updates at a lower frequency, resulting in better battery performance compared to the active mode. |
PASSIVE | Low | 100m | This mode is designed for minimal battery consumption. It provides low-accuracy location updates at longer intervals, making it suitable for scenarios where periodic location updates are sufficient and power efficiency is critical. |
This mode is designed for minimal battery consumption. It provides low-accuracy location updates at longer intervals, making it suitable for scenarios where periodic location updates are sufficient and power efficiency is critical.
When selecting a tracking mode, you should consider the specific needs of your application.
TRACKING_MODE_ACTIVE (Default): When you require highly accurate and real-time location updates. TRACKING_MODE_BALANCED: When a balance between accuracy and battery usage is desired. TRACKING_MODE_PASSIVE: When power efficiency is a priority and lower accuracy is acceptable.
In the meantime, you are also able to update the related configuration value after the initialization of LocationConfig
, and do the data tracking with the updated CUSTOM MODE.