Location Manager

Before starting tracking location using Asset SDK, you need to request location permissions using LocationPermissionsManager.requestLocationPermissions()

Required permissions

1<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
2<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
4// API level >= 29
5<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

Check if all requested permissions are granted

  1. Fine location or Coarse location permission is Checked


You can request Fine Location and Coarse location permissions using permissionsManager.requestLocationPermissions(this) and handle the permission result in the onRequestPermissionsResult callback.

  1. Request Fine location and Coarse location permissions first

  2. Handle the permission result

    1override fun onRequestPermissionsResult(
    2    requestCode: Int,
    3    permissions: Array<String>,
    4    grantResults: IntArray
    5) {
    6    super.onRequestPermissionsResult(requestCode, permissions, grantResults)
    7    permissionsManager?.onRequestPermissionsResult(requestCode, permissions, grantResults)

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 ( default ) High (the most accurate location) 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 (optimized for battery usage) 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 (​​coarse ~ 10 km accuracy location) 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.

When selecting a tracking mode, you should consider the specific needs of your application. If you require highly accurate and real-time location updates, choose TRACKING_MODE_ACTIVE (Default). If a balance between accuracy and battery usage is desired, TRACKING_MODE_BALANCED is a good option. And if power efficiency is a priority and lower accuracy is acceptable, TRACKING_MODE_PASSIVE is suitable. Moreover, You can also customize the related configurations for a LocationConfig object, to build a Customized Mode based on your need.


The default TrackingMode of Asset SDK is TrackingMode.ACTIVE, you can configure the location tracking mode

1val locationConfig = LocationConfig(TrackingMode.ACTIVE)

And you can customize the update interval of every mode

  1. interval: the desired interval between location updates in milliseconds.

  2. smallestDisplacement: Distance between location updates in meters, this displacement represents the minimum distance that needs to be covered before receiving a location update.

1val locationConfig = LocationConfig(trackingMode = TrackingMode.ACTIVE, interval = 30000, smallestDisplacement = 1000f)
2locationConfig.maxWaitTime = 100
3locationConfig.fastestInterval = 100
4locationConfig.enableStationaryCheck = true