Permissions
Last updated
Last updated
Go to the Capabilities tab of your target settings.
Turn on Background Modes and enable Location updates.
As DriveKit requires a user's location and motion data, it is required to get permissions from the user.
When the application requests permission for background locations or motion activities, a message will be shown to the user. You must configure this message by changing the value for the following keys in Info.plist
NSLocationWhenInUseUsageDescription
NSLocationAlwaysAndWhenInUseUsageDescription
NSMotionUsageDescription
Since iOS 13 and DriveKit SDK 1.1.3, location permission must be requested in two steps because the "Always Allow" option is no longer available in standard iOS location permission alert. You must first request when in use authorization (locationManager.requestWhenInUseAuthorization()
) and then ask the user to choose "Always Allow" option in the app settings and redirect user to the app settings page.
To ask for the location permission in a proper way, DriveKit provides the following function:
By default, the SDK incorporates the permission request to access Motion and Fitness. This allows for improved transportation mode recognition through the use of activity recognition based on motion properties.
Therefore, if you install DriveKit in your application, a permission request will be displayed to ask for the user's consent.
If you do not want to use this feature and want to control the user experience related to the Motion and Fitness permission request, it can be disabled.
To deactivate the Motion and Fitness permission request, call: