# Permissions

## Configure Capabilities

1. Go to the **Capabilities** tab of your target settings.
2. Turn on **Background Modes** and enable **Location updates**.

![](/files/-LnDVIhKDeg5HfoUYBVI)

## Configure permissions

As DriveKit requires a user's location and motion data, it is required to get permissions from the user.&#x20;

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`

## Ask for location permission

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:

```swift
DKDiagnosisHelper.shared.requestPermission(.location)
```

## Motion and Fitness permission

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](https://developer.apple.com/documentation/coremotion/cmmotionactivity) 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:

```swift
DriveKitTripAnalysis.shared.activateActivityRecording(false)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.drivequant.com/trip-analysis/ios/permissions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
