# Importing the SDK

## Importing repository

We recommend specifying the GitHub credentials as environment variables rather than hard-coding the actual username and Personal Access Token (PAT) into the build file.

To create a GitHub Personal Access Token (PAT), follow the instructions here: [Creating a personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token).\
You only need the following scope: `read:packages`

```
☐ write:packages       Upload packages to GitHub Package Registry
    ☑ read:packages   Download packages from GitHub Package Registry
```

## Using mavenLocal or your own repository

If you prefer not to access the binaries from `maven.pkg.github.com` you can install the SDK libraries in your own Maven repository, or using `mavenLocal` on your development machine.

To do so, copy the Maven files from the `android-sdk/com/` folder tree.

## Component Libraries

The IMS SDK is published as a set of library modules so that you can choose the features you wish to use. Each component has a specific task to perform.

* **tripdetectionumbrella:** Trip detection and recording, upload, DriveSync server interaction\
  Most applications use the SDK to detect and record trips. In this case only the **tripdetectionumbrella** module needs be specified; it will automatically link in the required sub-modules.
  * **distracteddriving:** Add-on for providing distracted driving related events while trip recording.\
    Trip scoring is enhanced by using the **distracteddriving** module, but this also requires special permissions so it is optional
* **portal:** DriveSync server interaction, such as fetching resources and presenting them as native objects\
  If your app displays DriveSync data but does not record trips you can specify the **portal** module instead of **tripdetectionumbrella.**
* **Devices:** Add-ons for detecting Bluetooth and other devices. (Also see [proguard](https://trakglobalgroup.atlassian.net/browse/SDK-415) in Obfuscation)
  * **devices-wedge:** Support for IMS Wedge **plus** all other BLE and Bluetooth device types
  * **devices-ble-nordic:** Support for BLE (Bluetooth Low Energy) devices **plus** other Bluetooth device types
  * **devices-bluetooth:** Support for Bluetooth audio, headset, and paired data devices

For example, the SDK Sample App uses a full set of SDK features (SDK 1.16):

```gradle
dependencies {
    ...  
    implementation 'com.intellimec.mobile.android:tripdetectionumbrella:1.18.0'
    implementation 'com.intellimec.mobile.android:distracteddriving:3.13.0'
    implementation 'com.drivesync.android:devices-wedge:1.18.0'
    
    //Additional needed libraries
    implementation 'com.google.android.gms:play-services-maps:18.2.0'
    implementation 'com.google.android.gms:play-services-awareness:19.0.1' //Only needed if using Awareness
    ...
}
```

The additional library binaries on Github are automatically pulled in as required.


---

# 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://sdk.ims.tech/readme/android/import-the-sdk.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.
