# Get started

Getting things done is a process. We make the process of turning your app into an incredible solution as easy as possible. Follow our guidelines to build your own solution for business.

## [Telematics SDK powers telematics inside Mobile apps](https://raxeltelematics.com/telematics-sdk)

![](/files/-MRKRymYpVOFVfpGnrdQ)

## What we provide

![](/files/-MTFJYqpgFtbt67IN0Es)

## Why it is better to work with us?

### In-house development vs our Telematics

* Telematics SDK provides **contactless telematics** powered by **AI**
* Telematics SDK **reduces R\&D and maintenance cost by 90%**
* Telematics SDK **reduces time to market** of any tracking apps from years **to a day**

### Analysis

|                     In-house development                     |                                       Telematics SDK                                      |
| :----------------------------------------------------------: | :---------------------------------------------------------------------------------------: |
| Long development cycle \~24 months, cost approximately $900k |                           Integration takes less than 60 minutes                          |
|     Expensive and inefficient maintenance \~$350k a year     | Saas model. Pay per usage. No licence fee and maintenance fee for Telematics SDK and APIs |

## :point\_right: [SDK Features](https://docs.telematicssdk.com/product-description/sdk-features)

## Telematics Platform features

{% content-ref url="/pages/-M2UNQ8AbRC1nf3aX-YY" %}
[\*User Management](/platform-features/back-end-as-a-service)
{% endcontent-ref %}

{% content-ref url="/pages/-M5rViyjbl1nJvudVQTN" %}
[\*Leaderboard](/platform-features/leaderboard-1)
{% endcontent-ref %}

{% content-ref url="/pages/-M2UN\_oZD5GOC\_JwZNDA" %}
[\*Vehicle Management](/platform-features/car-service)
{% endcontent-ref %}

{% content-ref url="/pages/-MK5mw-c3J6NDDGLH6bq" %}
[FNOL, Inspections & Damage Recognition](/platform-features/fnol-inspections-and-damage-recognition)
{% endcontent-ref %}

{% content-ref url="/pages/-M8zjpUzt9eBqViZLCM8" %}
[\*SNS](/platform-features/sns)
{% endcontent-ref %}

{% content-ref url="/pages/-M79MO6Mg5BZGD9JQERg" %}
[3rd party data processing](/platform-features/3rd-party-data-processing)
{% endcontent-ref %}


# 4  Steps to Integrate SDK

## 4  Steps to Integrate SDK

{% content-ref url="/pages/-LtcZb-3HCifGKO5K7Bh" %}
[Step 1: Create Datahub Account](/acc_reg)
{% endcontent-ref %}

\*\*\*

1. For the next step, please create a test user in Datahub. Follow [this link](https://userdatahub.com/create) to create a test DeviceToken. Please save this deviceToken, you will need it for SDK integration.
2. To help you with SDK integration, we published Demo apps for you. You can use them as an example for your project. :point\_right:[Demo app](/sdk-installation/demo-applications)

{% content-ref url="/pages/-LtbAMByB7qwNLWFdHzr" %}
[Step 2: SDK Installation](/sdk-installation/get-started)
{% endcontent-ref %}

You can test sdk integration using trip simulator in xCode and Android studio

\*\*\*

**Result:** after step 1 and 2 you are almost done with sdk integration. you already can drive and your trips will be available in datahub. The next two steps enable you to create devicetokens for all your app users and access statistics and trips.

\*\*\*

{% content-ref url="/pages/-LtiD8KUwoAK0Pny2jHy" %}
[Step 3: Register SDK users](/manage-service)
{% endcontent-ref %}

\*\*\*

You need step 4 only if you want to use our API to get trips, scoring, and statistics data to your app directly from our APIs. If you want to grab data and have your app worked only with your own API, please skip STEP 4, and complete this form :point\_right: [Platform integration](https://airtable.com/shrjLmYhxL6C6P8oq). we will do for you all the necessary settings.

{% content-ref url="/pages/-LvzxzRhXuxcUM6Te5fV" %}
[Step 4: Get Statistics, Scorings and Trip Data](/user-statistics-and-analytics/getstatistics)
{% endcontent-ref %}

## Description

| №     | Step                                                                                                                                                   | Description                                                                                                                                                                                         |
| ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **1** | Create Datahub [Account Registration](/acc_reg)                                                                                                        | [Register your company account in Datahub](https://docs.userdatahub.com) -> Register an app and products, then credentials for SDK Installation will be generated: `Instance ID` and `Instance Key` |
| 3     | <p><a href="/pages/-Ltcg7-HnUisG03DV4Pp">iOS SDK Installation </a></p><p></p><p><a href="/pages/-LtciezWgWzbv9hUS_1v">Android SDK Installation</a></p> | <p>Guidelines to install SDK.<br>It is a simple process that will not take more than 40 min.</p><p></p>                                                                                             |
| 3     | Register SDK users                                                                                                                                     | Register all your app users on your platform and store a unique devicetoken against a user record in your database.                                                                                 |
| **5** | [Get data via API](/user-statistics-and-analytics/getstatistics)                                                                                       | Get telematics data and user statistics via API to keep it on your side and carry out your own further analysis                                                                                     |

## Introduction

Before you start, we would like to introduce our SDK and the main components of our product.

![](/files/-LuNwBEpcGYMPpagkDZZ)

###


# Product Wiki

The page is a display of our product capabilities and it has the main goal to assist developers to navigate in our product set

## Telematics SDK

[iOS Telematics SDK](/sdk-installation/ios-sdk-intallation)

[Android Telematics SDK](/sdk-installation/android-sdk-installation)

[React Native](https://docs.telematicssdk.com/sdk-installation/ios-sdk-intallation/install-the-ios-library)

[Flutter - please contact us and we'll guide you.](https://www.raxeltelematics.com/contact/)

#### Features

[TAGs](/sdk-features/tags)

[Vehicle data (bluetooth OBD)](https://docs.telematicssdk.com/sdk-features/bluetooth-obd)

Driving behavior

Embedded assets

[iOS demo APP](/sdk-installation/demo-applications)

[Android demo APP](/sdk-installation/demo-applications)

[Swift demo APP](/sdk-installation/demo-applications)

## Engagement

[Leaderboards](/platform-features/leaderboard-1/leaderboard#leaderboard)

[Streaks](/platform-features/streaks)

## Account management

[User management](https://docs.telematicssdk.com/platform-features/back-end-as-a-service)

[Vehicle management](/platform-features/car-service)

## Platform

[Risk driving scoring](/product-description/scoring/riskdrivingscore)

[Eco-driving score](https://docs.telematicssdk.com/product-description/scoring/eco-scoring)

[FNOL, Vehicle inspection, and damage recognition](https://docs.telematicssdk.com/platform-features/fnol-inspections-and-damage-recognition)

[3rd party data processing](https://docs.telematicssdk.com/platform-features/3rd-party-data-processing)

#### Via SDK (to show in mobile apps)

[iOS User statistics](/response-codes/archive/back-end-to-app-integration/get-the-data-to-the-ios-app/statistics)

[iOS Trip details](/response-codes/archive/back-end-to-app-integration/get-the-data-to-the-ios-app/tracks)

[Android User statistics](/response-codes/archive/back-end-to-app-integration/get-the-data-to-the-android-app/user-statistics)

[Android trip details](/response-codes/archive/back-end-to-app-integration/get-the-data-to-the-android-app/tracks)

#### Via API

[User statistics](https://docs.telematicssdk.com/back-end-to-back-end-integration)

[Trip details](/user-statistics-and-analytics/processed-data)

#### Features

[Reporting](/product-description/reporting)

[SNS](https://docs.telematicssdk.com/platform-features/sns)


# License

Telematics SDK Standard license Terms\&Conditions

**1. ACCEPTANCE**

These DataMotion Service Terms together with the Privacy Policy and all other additional terms and information that may be provided within the Service (collectively "Terms") govern your use of the DataMotion 's services ("Service") that include items as per follows:

* DataMotion telematics engine (Telematics SDK) that works with smartphone sensors ("Telematics SDK")
* Web-interface the SAAS platform ("DATA HUB")&#x20;

By registering for or using the Service or any portion of it you accept the Terms.&#x20;

The Terms constitute an agreement between you ("Licensee") and DataMotion Pte.Ltd, UEN **201918904Z**, 68 CIRCULAR ROAD #02-01, SINGAPORE (049422), including its parents, subsidiaries, and affiliates (collectively "DataMotion"), defining your and DataMotion 's rights and responsibilities with respect to the Service.&#x20;

**2. LICENSE**

Subject to all terms hereof, DataMotion. hereby grants Licensee (i) a non-exclusive, non-transferable, revocable license to install and use the TELEMATICS SDK in object code solely for the purposes of integrating the TELEMATICS SDK into one Licensee mobile application ("Mobile Application") and to distribute the TELEMATICS SDK as part the Mobile Application and have such Mobile Application used by End Users, and (ii) a non-exclusive, non-transferable, revocable right to access through a web interface the DATA HUB that makes available information on End User routine behavior based on device data provided through the TELEMATICS SDK integrated in the Mobile Application installed on mobile devices of the End Users (such information and device data hereinafter jointly the "Data"). "End User" shall mean any person to which Licensee distributes its Mobile Application. A reference to the " TELEMATICS SDK" includes a reference to any part thereof and to any relating documentation.\
\
&#x20;As part of the Service, DataMotion may provide you with certain software developed by DataMotion or, its licensors ("Software"). Your use of Software may be subject to separate terms and conditions that you must accept before using the Software. If there are no separate terms and conditions applicable to such Software, the following terms apply: DataMotion grants to you a limited, non-exclusive, non-transferable right to install and use the Software on your mobile device. For DataMotion software, applicable open source license terms apply. \
\
&#x20;The Software maybe subject to export controls under your country regulations and other import or export control regulations. You agree to strictly comply with all applicable import and export regulations and acknowledge that you have the responsibility to obtain licenses to export, re-export, transfer, or import such Software. \
\
You are solely responsible for taking backup copies of the data you store on the Service. If the Service is discontinued or canceled, DataMotion may permanently delete your data. DataMotion has no obligation to return data to you after the Service is discontinued or canceled.&#x20;

**3. REGISTRATION**

To use a Service you may need to register and create a DATA HUB account with username and a password. You may need to provide us with certain personal and other information. HERE may verify your email address before account can be used. \
\
&#x20;You agree to provide truthful and complete information when you register for the Service and to keep that information updated. You must take due care to protect your username and password against misuse by others and promptly notify DataMotion about any misuse. You, and your parent or legal guardian if you are a minor, are personally responsible for any use of the Service.&#x20;

**4. COPIES**

Licensee is authorized to duplicate the TELEMATICS SDK for internal test and development purposes and for distribution of the Mobile Application to End Users. Licensee is further allowed to make a reasonable number of copies of the TELEMATICS SDK for non-productive backup and recovery purposes. Any and all such copies shall in all respects be subject to the terms and conditions of this agreement. Licensee shall not make copies of the TELEMATICS SDK additional to those expressly permitted in this agreement nor copy any documentation accompanying the TELEMATICS SDK other than as strictly needed for its permitted use. Licensee shall not remove or obscure any copyright and/or trademark notices or other proprietary notices in the TELEMATICS SDK. All notices must be duplicated as they appear on the TELEMATICS SDK on all authorized copies. <br>

**5. USING THE SERVICE**

You agree to:&#x20;

* Comply with applicable laws, the Terms and good manners;&#x20;
* Respect the privacy of others;&#x20;
* Not use any other technologies or initiate other activities that may harm the Service, or the interest or property of the Service users.&#x20;
* Not to use any automated systems or means to access, acquire, copy or monitor any part of the service.&#x20;
* DataMotion may but has no obligation to:&#x20;
* Monitor or moderate any Content;&#x20;
* Remove any Content from the Service; and&#x20;
* Restrict access to any part of the Service at any time in its sole discretion.&#x20;

**6. RESTRICTIONS**

Licensee may combine the TELEMATICS SDK with its Mobile Application. Except to the extent expressly permitted by law, Licensee shall not otherwise modify, adapt, merge or create derivative works of the TELEMATICS SDK nor electronically transfer into another computer language, translate, reverse engineer or reengineer the TELEMATICS SDK. Licensee will not (i) disclose its DATA HUB credentials ("Credentials") to any third party; (ii) disclose the TELEMATICS SDK to any third party other than (x) its service providers that are under obligations in respect of the TELEMATICS SDK no less stringent than those set forth herein, or (y) End Users as an integrated part of the Mobile Application; (iii) attempt to access any systems, programs or data of DataMotion to which no access is granted hereunder or that are not required for your activities in connection with this agreement; or (iv) use any device or software to interfere or attempt to interfere with the proper operation of DATA HUB. Licensee will notify DataMotion immediately if it learns of any unauthorized use of its Credentials or unauthorized acquisition of Data. Licensee will not, and will ensure that its End Users shall not decompile, disassemble, analyze or examine the TELEMATICS SDK or otherwise attempt to learn the source code, structure, algorithms or ideas underlying the TELEMATICS SDK (except to the extent allowed by the applicable laws), e.g. for the purpose of reverse engineering, re-engineering or rebuilding an SDK with the same or similar functionalities.&#x20;

**7. INTELLECTUAL PROPERTY RIGHTS**&#x20;

The TELEMATICS SDK and the DATA HUB are protected by applicable Singaporean and foreign laws and treaties, including copyright laws and treaty provisions. DataMotion and its third party licensors retain all title to, and, except as expressly and unambiguously licensed herein, all rights and interest in the TELEMATICS SDK and the Platform and all copies, versions, enhancements and derivative works thereof (other than the Licensee part of the Mobile Application) and all related documentation and materials, the DataMotion trademarks, trade names, icons and logos, and any and all intellectual property throughout the world in the foregoing. Except for the limited license granted herein, nothing herein shall be construed as DataMotion granting to Licensee or an End User any right, title or interest in or to the TELEMATICS SDK or the DATA HUB or any patent, trade secret or other intellectual property rights of DataMotion. All copies of the TELEMATICS SDK remain the property of DataMotion. The Data shall be owned by Licensee. DataMotion has the worldwide, non-exclusive, irrevocable, perpetual, royalty-free and fully paid-up right to use these Data in aggregated and anonymized form only for its internal business and marketing purposes, which include building statistical models and profiles.&#x20;

**8. FEEDBACK TO DATAMOTION**&#x20;

By submitting any ideas, feedback and/or proposals ("Feedback") to DataMotion through the Service or other means, you acknowledge and agree that: (1) DataMotion may have similar development ideas to the Feedback; (2) your Feedback does not contain confidential or proprietary information of you or any third party; (3) DataMotion is not under any obligation of confidentiality with respect to the Feedback; (4) DataMotion may freely use, distribute, exploit and further develop and modify Feedback for any purpose; and (5) you are not entitled to any compensation of any kind from DataMotion.&#x20;

**9. NOTICES**&#x20;

DataMotion may post notices within the Service. DataMotion may also send you notices about products and Services to the email address or telephone number you have provided to us. You are deemed to have received such notices at the latest within seven (7) days from DataMotion sending or posting those. Your continued use of the Services constitutes your receipt of all notices regardless of delivery method.&#x20;

**10. CONFIDENTIALITY**&#x20;

Each party (the "Recipient") acknowledges that any information supplied by the other party (the "Provider") (including but not limited to the terms of this agreement and the TELEMATICS SDK) is confidential and undertakes to keep secret any such information until it enters the public domain through no fault of Recipient. Recipient shall not without Provider's prior written consent disclose the information to any third party, nor use the same for any purpose other than exercising its rights or performing its obligations under this agreement. Recipient shall take all steps necessary to prevent any of the information becoming known to unauthorized third parties other than its agents, consultants and advisors subject to such agents, consultants and advisors entering into confidentiality agreements no less restrictive than the provisions hereof.&#x20;

**11. FEES**&#x20;

The Service offers subscriptions. You authorize the Service to place a periodical charge during the period of the subscription. The Service may also offer a trial period. If your Order involves a trial period (also known as try-and-buy), you may be charged when the trial period expires, unless you cancel in accordance with the subscription/trial terms. \
\
&#x20;The prices in the Service may change from time to time. Prices include applicable taxes in effect at the time of your transaction, unless otherwise stated. There may be instances where you incur additional charges from your bank or credit card provider based on currency conversion rates used and/or additional fees assessed. DataMotion assumes no responsibility for the payment of bank or any other third party service fees or charges.\
\
&#x20;Use of the Service may involve transmission of data through your service provider's network. Prices listed within the Service do not include possible data transmission, text message, voice or other service provision charges by your network service provider.\
&#x20;DataMotion assumes no responsibility for the payment of any charges of your service providers. \
\
&#x20;Payment of DataMotion 's invoices will be made within thirty (30) days of the invoice date by bank transfer in USD free of any deductions. All invoices shall be deemed accepted unless disputed in good faith within thirty (30) days after the invoice date. If an invoice is disputed, Fee shall pay the undisputed portion of the invoice when due. \
\
&#x20;Any amount due but not paid in full on the due date shall automatically and without prior notice be increased with an interest for late payment of ten percent (10%) per year. This amount will, by way of indemnity, automatically and without prior notice be increased by ten percent (10%) with a minimum of one hundred USD ($100) from the day following the due date of the invoice, in addition to the principal amount and the interest for late payment. \
\
&#x20;In addition to any other rights under this agreement, DataMotion shall have the right to suspend the use of the DATA HUB and connectivity of the TELEMATICS SDK in case of late payment. Fee will fully reimburse DataMotion the costs of notice, collection and recovery (including attorney's fees and expenses) made in connection with any unpaid invoice. DataMotion may increase the fees on an annual basis by giving thirty (30) days prior written notice to Licensee, provided that the annual percentage increase in the fees shall not exceed the aggregate percentage increase of the 10% per year&#x20;

**12. CANCELLATIONS AND REFUNDS**&#x20;

You agree to the electronic delivery of Service being initiated concurrently with the receiving of the first data set from TELEMATICS SDK under your Company ID. You will not be able to cancel your Service once it has been initiated. The nature of the Service is such that it cannot be returned. \
\
&#x20;In the event that after your Order you discover and promptly inform DataMotion within 48 hours that service you have ordered is faulty; (b) the Service delivers to you does not match the description of the Service you ordered via DataMotion or its parents, subsidiaries, affiliates or partners \
\
&#x20;Please note that HERE may not be able to process your customer support request if you are unable to provide your Company ID, which is provided to you by DataMotion following your account registration.&#x20;

**13. TERMINATION**&#x20;

This agreement enters into force on the Commencement Date and shall terminate on its one-year anniversary ("Initial Term"). This agreement shall automatically renew for successive one-year periods (each, a "Renewal Term") unless one party notifies the other in writing at least sixty (60) days prior to the end of the Initial Term or any Renewal Term that it does not wish to renew this agreement . This agreement and the rights granted to Licensee shall terminate on receipt of termination notice if Licensee fails to comply with any of the terms and conditions of this agreement (including non-payment within the time period specified in Section 4). Either party may terminate this agreement upon written notice in the event that the other party files a petition in bankruptcy or proceedings in bankruptcy are instituted against it, or any court assumes jurisdiction of such party and its assets pursuant to proceedings under any bankruptcy or reorganization act, or a receiver is appointed of that party's assets or that party makes an assignment for the benefit of its creditors. Upon termination, all licenses granted herein shall terminate, DataMotion may erase all Data, and Licensee shall immediately destroy all copies of the TELEMATICS SDK (including any documentation relating thereto) in its possession. Such termination shall be without prejudice to any other rights or remedies of DataMotion under this agreement or applicable law. Termination shall not relieve Licensee of its obligations which by their nature are intended to survive termination.&#x20;

**14. AVAILABILITY AND TECHNICAL REQUIREMENTS**&#x20;

The availability of Service may vary and is subject to DataMotion 's sole discretion. DataMotion expressly disclaims any representation or warranty that any particular Service will be available. The Service may not be available in all countries and may be provided only in accordance with country regulations The Service, operations and some features may also be dependent on the network, compatibility of the devices used. \
\
&#x20;To use the Service, you may need to use the latest version of TELEMATICS SDK \
\
&#x20;DataMotion may, in its sole discretion, change, correct or discontinue the Service in whole or in part. The Service may not be available during maintenance breaks and other times. If DataMotion considers a Software update to be important or critical you may not continue using the previous version of the Software. DataMotion may prevent your use of the previous version of the Software or Service until you install the update.&#x20;

**15. PERSONAL DATA**&#x20;

The Privacy Policy and any additional privacy information made available to you govern the use of your personal data.&#x20;

**16. INDEMNIFICATION**&#x20;

You agree to defend and indemnify DataMotion from and against all third party claims and all liabilities, assessments, losses, costs or damages resulting from or arising out of (i) any lost data or other indirect or consequential damages of any character, including, without limitation, damages for loss of profits, loss of goodwill, work stoppage, device failure or malfunction, or any and all other commercial damages or losses, (ii) the cost of procuring substitute products, services or technology, (iii) any use or loss of Data by Licensee or by any third party who has obtained such Data (directly or indirectly) from Licensee, or (iv) any amounts in excess of the License Fees paid to DataMotion under this agreement during the six (6) months preceding the date the cause of action arose. Licensee assumes total responsibility and risk for its use of the TELEMATICS SDK and the Data and distribution of the Mobile Application. Licensee shall indemnify, defend and hold DataMotion harmless from and against all claims, suits, proceedings, awards, judgments, penalties, fines, damages, losses, liabilities, costs and expenses resulting from any and all third party (including End Users and public authorities) claims against DataMotion relating to any breach of this agreement by Licensee or the End Users or any use of the Data (or loss of Data) by Licensee or by any third party who has obtained such Data (directly or indirectly) from Licensee. As used in this section, " DataMotion " includes its employees, directors, officers, agents, representatives, subcontractors, service providers and suppliers. Claims for damages must be made by Licensee within six months of the incident to which they relate or be forever barred.&#x20;

**17. MISCELLANEOUS**

**17.1 Choice of Law**

The Terms are governed by the laws of Singapore&#x20;

**17.2 Validity**&#x20;

The Terms neither exclude nor limit any of your mandatory rights in your country of residence that cannot by law be waived. If a provision of the Terms is found to be invalid, the remaining provisions will not be affected and the invalid provision will be replaced with a valid provision that comes closest to the result and purpose of the Terms. In the event one or more provisions of these Terms are not relevant to your use of the Service, it shall not impact the validity or enforceability of any other provision of the Terms or the Terms as a whole. If there is any conflict between these DataMotion Service Terms and the Privacy Policy, the provisions of these DataMotion Service Terms prevail. The provisions of the Terms that are intended to survive termination of your registration remain valid after termination.&#x20;

**17.3 Changes in Terms**&#x20;

DataMotion may modify the Terms at any time without prior notice. If the Terms are changed in a material, adverse way, DataMotion will provide a separate notice advising of the change. \
\
&#x20;You are responsible for regularly reviewing the Terms. Your continued use of the Service constitutes your consent to any changes and modification.&#x20;

**18. ASSIGNMENT**

DataMotion may assign its rights and obligations under these Terms to its corporate parent, its subsidiaries, or to any company under common control with DataMotion. Additionally, DataMotion may assign its rights and obligations under these Terms to a third party in connection with a merger, acquisition, sale of assets, by operation of law or otherwise. <br>


# FAQ

Short guides for common use cases

## How to get instance ID and Instance Key?

To get Instance ID and Instance Key, please proceed to your Datahub account -> Management -> Level "User group" -> User service credentials

:point\_right: [Read more how to get credentials](https://docs.userdatahub.com/management/credentials)

## Can I start the integration without account in DataHub?

You need datahub account to obtain credentials that are required for the integrations such as `Instance ID`, `Instance Key` as well as `Admin API credentials` to have advanced access to API services.

## How can I customise push-notification messages on Android?

It is easy, just follow the instructions:

* :point\_right: [Android push-notifications](https://docs.telematicssdk.com/sdk-installation/android-sdk-installation/configure-sdk-variables-for-notifications)
* :point\_right: [Android low battery mode](https://docs.telematicssdk.com/sdk-installation/android-sdk-installation/new-permissions-wizard-since-2.2.225-version#battery-optimization-permission-screen)

## Can I customise the permissions Wizard?

We provide fully customised wizards both for iOS and Android. Please find how to do that below:

* :point\_right: [Wizard customisation for Android App](https://docs.telematicssdk.com/sdk-installation/android-sdk-installation/new-permissions-wizard-since-2.2.225-version)
* :point\_right: [Wizard customisation for iOS App](https://docs.telematicssdk.com/sdk-installation/ios-sdk-intallation/ios-13-permissions-wizard)

## How to get statistics and scores?

* :point\_right:[Check **API Authorization rules** firstly to choose the correct **Authorization type**](https://docs.telematicssdk.com/back-end-to-back-end-integration/authentication)
* :point\_right:[Check this **comparison page** to choose the correct statistics methods according to your goals](https://docs.telematicssdk.com/back-end-to-back-end-integration/user-statistics-1)
* :point\_right:[If you'd like to get user's statistics to **moblie app** for a **single user**](https://docs.telematicssdk.com/back-end-to-back-end-integration/user-statistics-1/individual-statistics-and-scorings)
* :point\_right:[If you'd like to get statistics to your **back-end** services for a **single user or for all users** within single user group](https://docs.telematicssdk.com/back-end-to-back-end-integration/user-statistics-1/accumulated-statistics-and-scorings)
* :point\_right:[If you'd like to get statistics to your **back-end** services for a **single user group**](https://docs.telematicssdk.com/back-end-to-back-end-integration/user-statistics-1/consolidated-scorings-and-statistics)

## How to get all historical statistics and scores?

You need just to set up for example 2000 year in **startDate.** You can also pass registration date instead.<br>


# How it works

Overall information about Telematics SDK including data samples

## Simplified data flow

![](/files/-Lw-GQltGitxrwIGTX0i)

## How it works

| Step                                                                                                         |                                                                                                                                                                                                                  | Resources                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Step 1:** Smartphone <> Telematics SDK                                                                     | The SDK connects to smartphone sensors and automatically gathers information under certain rules. It works in background mode and doesn't require user's interactions with the app to start/stop trip recording. | <p><strong>Article:</strong> </p><p><a href="https://articles-resources.s3-ap-southeast-1.amazonaws.com/Smartphones+are+vectors+of+innovation.pdf">why smartphone telematics is better then hardware telematics</a></p> |
| <p><strong>Step 2:</strong></p><p>Data collection</p>                                                        | The SDK collects high-frequency sensors data from various sensors like GPS, Gyroscope, Accelerometer, Compass, Barometer, etc.                                                                                   | [Telematics Data Sample](https://articles-resources.s3-ap-southeast-1.amazonaws.com/Raw+Data+Example.csv) (example of fields, not a real sample)                                                                        |
| <p><strong>Step 3</strong></p><p>Data processing</p>                                                         | Collected data is going through 5 layers where it is being filtered, normalised, reconstructed, enriched and finally analysed.                                                                                   |                                                                                                                                                                                                                         |
| <p><strong>Step 4</strong></p><p>processed data is unlocked for users, business interfaces and services</p>  | Wide range of methods unlock an endless opportunity for our clients to get different level of data, including raw data, processed data, user statistics, driving scoring, etc.                                   | [API](/user-statistics-and-analytics/get-started-statistics-and-scoring-apis)                                                                                                                                           |
| <p><strong>Step 5:</strong></p><p>Work with familiar business application or use our DataHub or BI tools</p> | Detailed analysis and environment for every client to build own models, insights and digital products. The portal is quickly developing. Please, feel free for any feedback if you need any feature.             | [DataHub](https://docs.userdatahub.com/sandbox/sandbox-get-started)                                                                                                                                                     |


# SDK Features

## Works in background

SDK Collects data from smartphone sensors (GPS, Accelerometer, and Gyroscope) and transfers the data set to a platform when your app is closed or even when you swipe the app from a memory.

## Fully autonomous and self launched

SDK automatically detects driving/walking/cycling and other movements and starts automatically collects and transfers telematics data without any interaction from drivers

## High-frequency data collection

SDK captures 1Hz GPS data and up to 100Hz Accelerometer and gyro data. it enables us to detect all possible driving incidents like acceleration, Brakes, Cornering, phone usage, speeding

:point\_right: [Take a look at dataset](https://docs.telematicssdk.com/product-description/dataset)

## Low battery drain

We gently work with smartphone sensors and our algorithms help us work in the background and collect high-frequency data with a low battery drain. For average usage, we consume \~5% of battery (iPhone home screen - 6%)

## Multiple operational modes

**Behavior tracker** – SDK provides a reach and high-frequency dataset from smartphone sensors (GPS, Accelerometer, Gyroscope, wifi, Bluetooth networks around, etc.)

![](/files/-MTCM85o-vA2UzjEPLl3)

**Live GPS tracker** – SDK provides a real-time location dataset with manageable frequency.

![](/files/-MTCM85qtw8MOxYn9cKT)

## Matching a trip with an internal ID

SDK supports different types of tags that might be applied to a trip or to a group of trips or even for a piece of a trip. order ID can be applied to a trip via app or API and then you can use order ID to get all telematics and statistics data

:point\_right: [How to set a tag with an internal ID](https://docs.telematicssdk.com/sdk-features/tags)

## Multiple end-points/ platforms support

SDK supports multiple options:

* Get data directly from SDK
* Point data to 3rd party platform :point\_right: [How to do that](https://docs.userdatahub.com/management/point-realtime-data-to-3rd-party-platform)
* Raxel platform

## Scheduled and on-demand tracking

We respect driver privacy and SDK supports flexible tracking options:

**Automatic** – SDK stays active in the background and listens to any activities 27×7. every time when SDK detects driving it starts recording data and broadcasting it to the platform

**Scheduled** – companies that work with full-time drivers that work from (let’s say) 9am to 5pm can apply a schedule and SDK will work only during these hours and will be automatically disabled beyond working hours. :point\_right: [How to set a schedule](https://docs.userdatahub.com/management/schedule)

**On-demand** – SDK can be enabled and disabled by app or via API to track a particular time period. for example: you can enable SDK only when the driver accepts a job, and disable it when the driver completes the job. :point\_right: [How to enable/Disable SDK](https://docs.telematicssdk.com)


# Scoring

{% content-ref url="/pages/-Lw3KifDldQK4-RDAVqP" %}
[Risk driving Scoring](/product-description/scoring/riskdrivingscore)
{% endcontent-ref %}

{% content-ref url="/pages/-MJ83poNeSXHiuTT2XgN" %}
[Eco Scoring](/product-description/scoring/eco-scoring)
{% endcontent-ref %}


# Risk driving Scoring

a brief introduction of our scoring model

This document describes how and which events are detected by the Raxel SDK, how the scores are generated for each individual parameter of the trip, how these scores are aggregated into total score, and how the total driver rating is finally generated for a given period.

Rating description presents the universal approach, developed by our company on the basis of many years of experience; most of the input variables presented in this document could be adopted depending on the needs of the company and the focus on the specific characteristics of clients' driving style.

Since 2019 we have moved to the 3rd Generation of the scoring model which allows distinguishing a context of events and add penalty points in accordance with a level of risk generated by an event

{% content-ref url="/pages/-Ltikkd2wma\_QBoA4UWk" %}
[Statistics and Scoring APIs](/user-statistics-and-analytics/get-started-statistics-and-scoring-apis)
{% endcontent-ref %}

## High level Scoring algorithm

![](/files/-MGEdIBuypkmWa9I1Igs)

#### Use Case: [Generation 3 vs Generation 1,2](https://articles-resources.s3-ap-southeast-1.amazonaws.com/Deck+-+Scoring.pdf)


# Event detection

Overall description of collected data and algorithm of identifying

## Data gathered by Telematics SDK:

1. GPS (1hz)
2. Data from gyroscope, magnetometer, and accelerometer (60hz)
3. Data on whether the device is locked and the screen is on
4. All data is depersonalised

## Description of event detection algorithms:

### Speeding

1. At each driving moment Telematics SDK collects the user's speed
2. This data is compared with the existing speed limits provided by our partners (Location platforms: HERE, Google, etc.)
3. We detect at which points there was speeding and than combine detected time intervals into events with a minimum duration of 3 seconds and maximum gap of 5 seconds between them
4. Variables influencing the rating:
   * Event duration
   * Speed limit
   * Speed

### Phone usage

1. Phone usage is detected by ML model, the main input is the data from (2) and (3)
2. We detect at which points there was phone usage and than combine detected time intervals into events with a minimum duration of 3 seconds and maximum gap of 20 seconds between them
3. Variables influencing the rating:
   * Event duration
   * Speed

### Acceleration

1. User's phone reads data of item (2).
2. Our algorithms continuously adapt phone axes to calculate correct accelerations.
3. The resulting accelerations in the direction of movement are transformed into an event if the driver has accelerated >3 m/s2.
4. We detect at which points there was acceleration and than combine detected time intervals into events with a minimum duration of 0.6 seconds and maximum gap of 3 seconds between them.
5. Variables influencing the rating:
   * Event duration
   * Acceleration value
   * Speed

### Braking (Deceleration)

1. User's phone reads data of item (2)
2. Our algorithms continuously adapt phone axes to calculate correct decelerations
3. The resulting decelerations in the direction of travel are transformed into an event if the driver has slowed down >3.2 m/s2.
4. We detect at which points there was deceleration and than combine detected time intervals into events with a minimum duration of 0.6 seconds and maximum gap of 3 seconds between them.
5. Variables influencing the rating:
   * Event duration
   * Deceleration value
   * Speed

### Cornering

1. User's phone reads data of item (2).
2. Our algorithms continuously adapt phone axes to calculate correct accelerations.
3. The resulting accelerations in the direction of motion are transformed into an event if the perpendicular acceleration to the direction of motion >4.2 m/s2.
4. We detect at which points there was acceleration and than combine detected time intervals into events with a minimum duration of 0.6 seconds and maximum gap of 3 seconds between them.
5. Variables influencing the rating:
   * Event duration
   * Deceleration value
   * Speed


# Trip rating

This section describes the way of how events and their characteristics are transformed to track rating.

1. Each track has a collection of events
2. Each event has it’s characteristics
3. Number of penalty points is proportional to risk factor of event
4. Points of track:
   * Phone usage points
   * Cornering points
   * Braking points
   * Acceleration points
   * Overspeeding points
5. Total points of the ride is a weighted sum of parameters' points.
6. Total points of the ride are weighted by the distance of the ride
7. Total and parameter weighted points are transformed to 100-scale
8. Star rating:
   * 100 - 5 star
   * \>= 90 - 4 star
   * \>= 80 - 3 star
   * \>= 70 - 2 star
   * < 70 - 1 star

{% content-ref url="/pages/-LtwSbMCxF\_4D03284b4" %}
[Trips API](/user-statistics-and-analytics/processed-data)
{% endcontent-ref %}


# Overall scoring

This section describes the way of how user receives his aggregate scoring (usually, 2-weeks)

1. User’s sum of points for 2-week period:
   * Phone usage points
   * Cornering points
   * Braking points
   * Acceleration points
   * Overspeeding points
   * Total points
2. Points of the ride are weighted by the distance of the ride
3. Total and parameter weighted points are transformed to 100-scale
4. Minimum distance to receive scoring is 400 km

![Daily Scoring Calculation](/files/-MJ2hwP3I1wpKqDGNvjU)

{% content-ref url="/pages/-MIdd6zHf12nqHwYMOTW" %}
[Get started - Statistics and Scoring API](/user-statistics-and-analytics/get-started-statistics-and-scoring-apis/user-statistics-1)
{% endcontent-ref %}


# Eco Scoring

How eco scoring is calculated

## Fuel Consumption

Fuel consumption scoring is a measure of the difference between ideal driving behavior in terms of fuel consumption and actual driving style.

Fuel consumption scoring is based on the next factors:

* Accelerations/braking
* Speed volatility
* Extreme speeds

## Tyres

Tyres scoring is based on the next factors:

* Accelerations/Decelerations/Cornerings
* Speed
* Temperature
* Quality of the road
* Type of the road
* Mileage

## Brakes

Brakes scoring is based on the next factors:

* Decelerations
* Temperature
* Mileage

{% content-ref url="/pages/-MIdd6zHf12nqHwYMOTW" %}
[Get started - Statistics and Scoring API](/user-statistics-and-analytics/get-started-statistics-and-scoring-apis/user-statistics-1)
{% endcontent-ref %}


# Dataset

## Raw data sample

{% content-ref url="/pages/-MTMlkm52r7sxeVBcqG-" %}
[Data samples](/product-description/dataset/data-samples-1)
{% endcontent-ref %}

{% content-ref url="/pages/-MRqJ4ceeIjT5rcDRQNv" %}
[Dataset](/product-description/dataset)
{% endcontent-ref %}


# Dataset | User statistics API

a description of data set that is collected by SDK and processed by platform

## Trip details

| Item        | Description                        |
| ----------- | ---------------------------------- |
| Time\_start |                                    |
| Time\_end   |                                    |
| Duration    | Trip duration                      |
| Mileage     | Trip mileage                       |
| Start point | Start latitude; Start longitude    |
| End point   | Finish latitude; Finish longitude  |
| Trip mode   | Car, train, public transport, etc. |
| User Label  | Driver, Passenger                  |
| Tag         | List of tags added to the trip     |

## Statistics (trip/driver/consolidated: Instance/application/product/Company)

| Item                       | Units                  | Description |
| -------------------------- | ---------------------- | ----------- |
| Mileage                    | km \| ml               |             |
| Predicted\_annual\_mileage | km \| ml               |             |
| Trips\_count               | qty.                   |             |
| Max\_speed                 | km/h \| ml/h           |             |
| Average\_speed             | km/h \| ml/h           |             |
| Total speeding             | km \| ml \| min \| qty |             |
| > Speeding\_level1         | km \| ml \| min \| qty |             |
| > Speeding\_Level2         | km \| ml \| min \| qty |             |
| > Speeding\_Level3         | km \| ml \| min \| qty |             |
| Cornering                  | qty                    |             |
| Phone\_Usage               | km \| ml \| min \| qty |             |
| Acceleration               | qty                    |             |
| Braking                    | qty                    |             |
| Driving\_time              | min                    |             |
| > Night\_driving           | km \| ml \| min        |             |
| > Day\_driving             | km \| ml \| min        |             |
| > Rushhours\_driving       | km \| ml \| min        |             |

## **Scoring** (trip/driver/consolidated: Instance/application/product/Company)

| Item                  | Description               |
| --------------------- | ------------------------- |
| Safe\_Score           |                           |
| > Acceleration\_score |                           |
| > Braking\_score      |                           |
| > Speeding\_score     |                           |
| > Distracted\_score   | Phone usage while driving |
| > Cornering\_score    |                           |
| Acceleration\_points  |                           |
| Braking\_points       |                           |
| Speeding\_points      |                           |
| Distracted\_points    | Phone usage while driving |
| Cornering\_points     |                           |


# Data samples

:point\_right: **Summary**

{% content-ref url="/pages/-MTMlZwl2t3wLzJ3RJA5" %}
[Broken mention](broken://pages/-MTMlZwl2t3wLzJ3RJA5)
{% endcontent-ref %}

{% content-ref url="/pages/-MTMnXsB3nz2zCCXNv-V" %}
[Broken mention](broken://pages/-MTMnXsB3nz2zCCXNv-V)
{% endcontent-ref %}

{% content-ref url="/pages/-MTMnXsB3nz2zCCXNv-V" %}
[Broken mention](broken://pages/-MTMnXsB3nz2zCCXNv-V)
{% endcontent-ref %}

:keyboard: **Raw data from the platform**

{% content-ref url="/pages/-MTMmB0LcLxMojXLUMSU" %}
[Broken mention](broken://pages/-MTMmB0LcLxMojXLUMSU)
{% endcontent-ref %}

{% content-ref url="/pages/-MTMn81Frv6yLkH4RqeE" %}
[Broken mention](broken://pages/-MTMn81Frv6yLkH4RqeE)
{% endcontent-ref %}

:desktop: **Processed data from the platform**

{% content-ref url="/pages/-MTMoFlxab-vAGVj\_L0A" %}
[Broken mention](broken://pages/-MTMoFlxab-vAGVj_L0A)
{% endcontent-ref %}


# Dataset Decription

#### :mobile\_phone: Raw data from Smartphone

{% content-ref url="/pages/-MRqJKUh6jTpTP75DmtG" %}
[Raw telematics data from SDK](/product-description/dataset/dataset-decription/raw-data)
{% endcontent-ref %}

:keyboard: **Raw data from Platform**

{% content-ref url="/pages/-MTEw1YjWUGO7bIl8p2O" %}
[IncomingTrackPoints](/product-description/dataset/dataset-decription/incomingtrackpoints)
{% endcontent-ref %}

{% content-ref url="/pages/-MTEqUwMf8-mlXIo32ri" %}
[IncomingTrackEvents](/product-description/dataset/dataset-decription/incomingtrackevents)
{% endcontent-ref %}

:desktop: **Processed data**

{% content-ref url="/pages/-MT692SI0u2EI8Mupp9z" %}
[Enriched telematics data](/product-description/dataset/dataset-decription/enriched-telematics-data)
{% endcontent-ref %}

{% content-ref url="/pages/-MTEw4yUJIduv0orF7mw" %}
[LastKnownPoints](/product-description/dataset/dataset-decription/lastknownpoints)
{% endcontent-ref %}

:blue\_car: **Vehicle data**

{% content-ref url="/pages/-MRyrHw1W41avY-uG5QA" %}
[Bluetooth OBD - Vehicle Dataset](/product-description/dataset/dataset-decription/bluetooth-obd)
{% endcontent-ref %}


# Bluetooth OBD - Vehicle Dataset

## Vehicle Data format

```
VehicleIndicators:
{
  "EngineLoad": 0.0, 
  "RPM": 0.0, 
  "IntakeAirTemperature": 0.0,
  "VehicleSpeed": 0.0, 
  "AcceleratorPedalPosition": 0.0, 
  "EngineCoolantTemperature": 0.0, 
  "FuelLevel": 0.0, 
  "FuelType": 0.0, 
  "FuelConsumption": 0.0,
  "ReadTroubleCodes": "P1000,P0200,B0200,U0100"
  "VIN": "1HGCM82633A004352",
  "WorkProtocol": "A0", 
  "VehicleVoltage": 0.0, 
  "VehicleMileage": 0.0,
  "PIDs": "0100:BE1FA813,0120:00000000,0900:00000000"
}
```

Potentially, we can add other fields. Please, feel free to talk to our team for that.\
All available fields for OBD2 protocol you can find here: <https://en.wikipedia.org/wiki/OBD-II_PIDs>


# LastKnownPoints

| **Field**       | **Short Description**        | **Additional Info** |
| --------------- | ---------------------------- | ------------------- |
| Id              |                              |                     |
| IncomingTrackId |                              |                     |
| PointDate       |                              |                     |
| Accuracy        | Accuracy of points in meters |                     |
| Latitude        |                              |                     |
| Longitude       |                              |                     |
| PointOrigin     | Origin of point              | Heartbeat/Trac      |


# IncomingTrackPoints

| Id                    | Incoming point id                       | Unique points id                                      |
| --------------------- | --------------------------------------- | ----------------------------------------------------- |
| IncomingTrackId       | Incoming track id                       |                                                       |
| Number                | Order number of point in incoming track | Starts from 0                                         |
| TotalMeters           | Meter made to this point (meters)       |                                                       |
| Speed                 | Speed at this timestamp (km/h)          |                                                       |
| PointDate             | Timestamp of point                      |                                                       |
| TickDate              | TickDate                                |                                                       |
| Latitude              | Latitude in degrees                     |                                                       |
| Longitude             | Longitude in degrees                    |                                                       |
| Height                | Height above sea level in centimeters   |                                                       |
| Course                | Course of device in degrees GPS         |                                                       |
| Yaw                   | Maneuvres data                          |                                                       |
| Lateral               | Maneuvres data                          |                                                       |
| Acceleration          | Acceleration in m/s2                    |                                                       |
| Deceleration          | Deceleration in m/s2                    |                                                       |
| TickTimestamp         | Timestamp                               |                                                       |
| DeviceToken           | Token of user                           |                                                       |
| CompanyId             | Id of user's company                    |                                                       |
| AccelerationX         | Acceleration after calc, m/s2           |                                                       |
| AccelerationY         | Acceleration after calc, m/s2           |                                                       |
| AccelerationZ         | Acceleration after calc, m/s2           |                                                       |
| GyroscopeX            | Gyroscope after calc                    |                                                       |
| GyroscopeY            | Gyroscope after calc                    |                                                       |
| GyroscopeZ            | Gyroscope after calc                    |                                                       |
| AccelerationXOriginal | Raw acceleration, m/s2                  |                                                       |
| AccelerationYOriginal | Raw acceleration, m/s2                  |                                                       |
| AccelerationZOriginal | Raw acceleration, m/s2                  |                                                       |
| GyroscopeXOriginal    | Raw Gyroscope                           | in G - iOS; in m/s2 - Android                         |
| GyroscopeYOriginal    | Raw Gyroscope                           |                                                       |
| GyroscopeZOriginal    | Raw Gyroscope                           |                                                       |
| accuracy              | Accuracy of GPS data in meters          | 10 means the points mistake is in radius of 10 meters |
| screenenabled         | 1-enabled 0-disabled                    | \*when users talk on the phone screen enabled is 1    |

###


# IncomingTrackEvents

| **Field**       | **Short Description**                                                                             | **Additional Info**                                                                                                                                |
| --------------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| Id              | unique id of event                                                                                |                                                                                                                                                    |
| incomingtrackid | id of incoming track                                                                              |                                                                                                                                                    |
| eventtype       | type of event                                                                                     | cornering/braking/acceleration                                                                                                                     |
| timestart       | time of event start                                                                               |                                                                                                                                                    |
| durationms      | duration of event in ms (including all gaps between acceleration points - time from start to end) |                                                                                                                                                    |
| packedvalues    | JSON of events characteristics                                                                    | :point\_right: [Described in richtrackevents](https://docs.telematicssdk.com/product-description/dataset/enriched-telematics-data/richtrackevents) |


# Enriched telematics data

Enriched telematics data contains information about tracks, points, and events after road mapping, events detection and filtering, scoring and other ML enrichment

| Table Name                                                                                                                          | Short Description                               | Enrichment result                                                                                                                                                                                          |
| ----------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [RichTracks](/product-description/dataset/dataset-decription/enriched-telematics-data/richtracks-1)                                 | Enriched tracks with scoring                    | <p></p><ul><li>Final track entity based on RichTrackPoints</li><li>Scores calculated</li><li>Aggregated metrics on track events</li><li>Addresses of start and stop</li></ul>                              |
| [RichTrackPoints](/product-description/dataset/dataset-decription/enriched-telematics-data/richtrackpoints)                         | Enriched track points                           | <p></p><ul><li>Track matching to road graph (HERE maps)</li><li>Speed limits (HERE maps)</li><li>Events matched to points (HF and GPS)</li><li>Phone usage (ML)</li><li>Rotation calculated (ML)</li></ul> |
| [RichTrackEvents](/product-description/dataset/dataset-decription/enriched-telematics-data/richtrackevents)                         | Enriched events                                 | <p></p><ul><li>Events JSON parsing</li><li>Mapping phone usage to events</li><li>Calculating the index - fitstresholds (ML)</li></ul>                                                                      |
| [RichTrackDetails](/product-description/dataset/dataset-decription/enriched-telematics-data/richtrackdetails)                       | Scoring Points for track and 100-scale rankings | <p></p><ul><li>Aggregated points for 2-weeks period</li><li>Scores for track in 100-scale</li></ul>                                                                                                        |
| [UserStatisticDrivingDetails](/product-description/dataset/dataset-decription/enriched-telematics-data/userstatisticdrivingdetails) | Scoring for dates                               | <p></p><ul><li>Aggregated scores for 2-weeks period</li></ul>                                                                                                                                              |


# RichTracks

| Field                        | Short Description                                                               |
| ---------------------------- | ------------------------------------------------------------------------------- |
| Id                           | unique id of rich track                                                         |
| TrackToken                   | Track Token                                                                     |
| DeviceToken                  | Device Token                                                                    |
| IncomingTrackId              | Incoming track id                                                               |
| StartDate                    | Start Date                                                                      |
| EndDate                      | End Date                                                                        |
| Distance                     | Distance in km                                                                  |
| Duration                     | Duration in minutes                                                             |
| AccelerationCount            | Acceleration Count per Track                                                    |
| DecelerationCount            | DecelerationCount per Track                                                     |
| Rating                       | 5-star Scoring                                                                  |
| PhoneUsage                   | Phone Usage in minutes                                                          |
| TrackOrigin                  | Track source from application or Machine Learning                               |
| OriginChanged                | Flag of changing track source                                                   |
| AddressStart                 | Address Start from Here                                                         |
| AddressFinish                | AddressFinish from Here                                                         |
| DistanceGPS                  | DistanceGPS - distance based on enriched data km                                |
| Urban                        | City Flag; 1-City; 0-rest                                                       |
| Region                       | Region from start point                                                         |
| Country                      | Country from start point                                                        |
| RatingOverSpeed              | 5-star RatingOverSpeed                                                          |
| RatingAcceleration           | 5-star RatingAcceleration                                                       |
| <p>RatingPhoneUsage <br></p> | 5-star RatingPhoneUsage                                                         |
| OverSpeedMileage             | Mileage with 10-20 OverSpeed in km (over km/h)                                  |
| MidOverSpeedMileage          | Mileage with 20-30 OverSpeed in km (over km/h)                                  |
| HighOverSpeedMileage         | Mileage with 30+ OverSpeed in km (over km/h)                                    |
| OriginalTrackOrigin          | If track origin is changed; original track origin moves to this field           |
| CompanyId                    | Id of company                                                                   |
| RushHours                    | Driving time in rush hours in minute (8-10, 17-19)                              |
| NightHours                   | Driving time in night hours in minute (23-6)                                    |
| DailyHours                   | Driving time in other hours in minute                                           |
| RatingDeceleration           | 5-star RatingDeceleration                                                       |
| MaxSpeed                     | Average Speed (km/h)                                                            |
| AverageSpeed                 | Average Speed (km/h)                                                            |
| PhoneUsageKm                 | <p>Phone Usage in km<br>shared 1 if ride is shared with other user</p>          |
| citystart                    | Start City                                                                      |
| cityfinish                   | Finish City                                                                     |
| updatedt                     | date of update in DB                                                            |
| corneringcount               | Number of cornering within the trip                                             |
| ratingcornering              | 5-star RatingCornering                                                          |
| beaconid                     | Euclidean norm of the difference between enriched and incoming points in meters |
| deviationmeters              | Euclidean norm of the difference between enriched and incoming points in meters |
| vehicletoken                 | Vehicle Token                                                                   |
| datecreated                  | date of creation in DB                                                          |


# RichTrackPoints

| Field            | Short Description                                      |
| ---------------- | ------------------------------------------------------ |
| Id               | Unique if of point                                     |
| RichTrackId      | RichTrackId                                            |
| Number           | Number of point in track                               |
| TotalMeters      | Distance since start of track enriched (meters)        |
| Speed            | Speed in point (km/h)                                  |
| MidSpeed         | Average speed since previous point (km/h)              |
| PointDate        | Point time                                             |
| Latitude         | Latitude (enriched)                                    |
| Longitude        | Longitude (enriched)                                   |
| Height           | Height from GPS                                        |
| Course           | Course from GPS                                        |
| Yaw              | Yaw from GPS                                           |
| Lateral          | Lateral acceleration                                   |
| AlertType        | AlertType acc for acceleration; deacc for deceleration |
| AlertValue       | Value of acceleration/deceleration in m/s2             |
| SpeedType        | Speed type for colouring map                           |
| SpeedLimit       | Speedlimit in km/h                                     |
| PhoneUsage       | PhoneUsage 1 for use of phone                          |
| Acceleration     | Acceleration front value of acceleration in m/s2       |
| Deceleration     | Deceleration front value of deceleration in m/s2       |
| TickTimestamp    | Timestamp                                              |
| Urban            | Flag of city                                           |
| FromSource       | Original or added by enchment point                    |
| LinkIdMatched    | HERE matched id                                        |
| TypicalSpeed     | Speed typical for this point                           |
| RoadType         | Road Type (HERE)                                       |
| Midroute         | Distance since previous point                          |
| Interval         | Duration since previous point                          |
| Turn             | Turn flag (left - right - no turn)                     |
| LaneCount        | Lane Count Number of lanes on the road                 |
| SpeedLimitSource | Partner id 2-Here                                      |
| TotalMetersGPS   | Distance since previous point original                 |
| MidrouteGPS      | Distance since previous point original                 |
| DeviceToken      | DeviceToken                                            |
| CompanyId        | Id of company                                          |
| Cornering        | 1 for cornering                                        |
| Rotation         | Rotation in point                                      |
| Deviation meters | Deviation from associated incoming points              |
| s2index          | Index of google s2 cell; 16-level                      |
| eventid          | id of richtrackevent                                   |
| straightroad     | 1 if curvature of the road is >= 1700                  |


# RichTrackEvents

| Field            | Short Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id               | Event unique id                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| richtrackid      | Rich Track Id                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| type             | type of event;Acceleration/Braking/Cornering                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| timestart        | time of event start                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| durationms       | Duration of the event with all gaps between acceleration points in ms                                                                                                                                                                                                                                                                                                                                                                                                                   |
| puredurationms   | Duration of points with acceleration >= threshold in ms                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| speedstart       | GPS speed at the beginning of event                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| speedstop        | GPS speed at the end of event                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| speedmedian      | Median GPS speed during event                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Accelerations    | <p></p><p>Type:</p><ul><li>Direct - in direction of movement</li><li>Lateral - perpendicular to the movement direction</li><li>Vertical - vertical acceleration</li></ul><p>Calc type:</p><ul><li>Without postfix - at the beginning of event</li><li>min - minimum during event</li><li>max - maximum during event</li><li>end - at the end of event</li><li>05 - 5%-quantile during event</li><li>95 - 95%-quantile during event</li><li>median - 50%-quantile during event</li></ul> |
| Accuracy         | <p></p><p>GPS accuracy during event</p><p>Calc type:</p><ul><li>Without postfix - at the beginning of event</li><li>min - minimum during event</li><li>max - maximum during event</li><li>end - at the end of event</li><li>05 - 5%-quantile during event</li><li>95 - 95%-quantile during event</li><li>median - 50%-quantile during event</li></ul>                                                                                                                                   |
| Speed            | <p></p><p>GPS speed during event</p><p>Calc type:</p><ul><li>Without postfix - at the beginning of event</li><li>min - minimum during event</li><li>max - maximum during event</li><li>end - at the end of event</li><li>05 - 5%-quantile during event</li><li>95 - 95%-quantile during event</li><li>median - 50%-quantile during event</li></ul>                                                                                                                                      |
| LatitudeStart    | Latitude of event start                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| LongitudeStart   | Longitude of event start                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| LatitudeFinish   | Latitude of event finish                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| LongitudeFinish  | Longitude of event finish                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| PhoneUsagePoints | Indicator of phone usage in this event; based on ML algorithm; if 1 then event is ignored; 1-we don’t use event                                                                                                                                                                                                                                                                                                                                                                         |
| fitstresholds    | Indicator of event adequacy; based on ML algorithm; 1-we use event                                                                                                                                                                                                                                                                                                                                                                                                                      |


# RichTrackDetails

| Field           | Short Description                         |
| --------------- | ----------------------------------------- |
| Richtrackid     | Id of rich track                          |
| id              | id of detail                              |
| devicetoken     | user’s devicetoken                        |
| avglat          | Average Latitude of track                 |
| avglon          | Average Longitude of track                |
| startlat        | Start Latitude of track                   |
| startlon        | Start Longitude of track                  |
| finishlat       | Finish Latitude of track                  |
| finishlon       | Finish Longitude of track                 |
| starts2index    | Google s2 start index of track (16 level) |
| finishs2index   | Google s2 end index of track (16 level)   |
| accpoints       | Acceleration penalty points               |
| deaccpoints     | Deceleration penalty points               |
| speedpoints     | Overspeeding penalty points               |
| phonepoints     | Phone Usage penalty points                |
| corneringpoints | Cornering penalty points                  |
| totalpoints     | Total penalty points                      |


# UserStatisticDrivingDetails

| Field             | Short Description                              |
| ----------------- | ---------------------------------------------- |
| devicetoken       | Token of user                                  |
| calcdate          | Date of calculation                            |
| scoreacceleration | 2-weeks acceleration score                     |
| scoredeceleration | 2-weeks deceleration score                     |
| scorespeeding     | 2-weeks overspeeding score                     |
| scoredistraction  | 2-weeks phone usage score                      |
| scoreturn         | 2-weeks turn score                             |
| score             | 2-weeks total score                            |
| accpoints         | acceleration penalty points for 2-weeks period |
| deaccpoints       | braking penalty points for 2-weeks period      |
| speedpoints       | overspeed penalty points for 2-weeks period    |
| phonepoints       | phone usage penalty points for 2-weeks period  |
| corneringpoints   | cornering penalty points for 2-weeks period    |
| totalpoints       | total penalty points for 2-weeks period        |


# Raw telematics data from SDK

### **JSON structure (example attached):**

```
{"Track": {
  "StartDate": "2020-01-24T12:03:33+0300",
  "StopReason": "StopTrackingManually",
  "Events": [...],
  "Points": [...],
  "EndDate": "2020-01-24T12:20:27+0300",
  "LastKnownPoints": [...]
  }
}

```

| **Field**                                                                          | **Description**                          |
| ---------------------------------------------------------------------------------- | ---------------------------------------- |
| StartDate                                                                          | StartDate                                |
| StopReason                                                                         | Reason of track stop                     |
| [Events](/product-description/dataset/dataset-decription/incomingtrackevents)      | Raw high-frequency events                |
| [Points](/product-description/dataset/dataset-decription/incomingtrackpoints)      | Raw GPS points of the track              |
| EndDate                                                                            | EndDate                                  |
| [LastKnownPoints](/product-description/dataset/dataset-decription/lastknownpoints) | Last known GPS points before track start |


# Reporting

List of reports that can be automatically generated per request of automatically to a company storage

We provide an automatic reporting system that daily generates a report by instances or applications and transfer it to S3 bucket (AWS) (we will support other storages soon).&#x20;

To set up the daily reporting, please write to us to <support@telematicssdk.com> and provide us with the following information:

1. **Instance ID (can be found in your** [**DataHub**](https://docs.userdatahub.com/sandbox/sandbox-get-started) **account)**

```
Instance ID:
```

&#x20;  **2. AWS S3 bucket credentials**

```
S3 bucket arn:
S3 bucket region: 
access key id:
secret access key:
```

The service contains the following reports:

| Name of report     | Description                                                                                                                                          |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| Trip summary       | The report contains a daily trip log, statistics and scoring information. TripID can be used to retrieve waypoints and events per each trip          |
| Scoring summary    | The report contains a daily scoring snapshot by users including points and scoring by factors. Values are calculated based on a scoring calculation. |
| User state         | A daily snapshot that contains a list of users and granted permissions                                                                               |
| Fraud              | A list of suspicious events generated by users by changing permissions or deactivating app                                                           |
| Trip waypoints     | A list of waypoints per each trip with information about speed limits and points where distracted driving has been detected                          |
| Trip events        | A list of trip events that we recognise as events impact on safe driving                                                                             |
| Drivecoins summary | Calculated drivecoins based on applied rules                                                                                                         |

{% content-ref url="/pages/-M2UIQfrcm26VqNdJlKA" %}
[Broken mention](broken://pages/-M2UIQfrcm26VqNdJlKA)
{% endcontent-ref %}

{% content-ref url="/pages/-M2UGXuZmTud5arO0Yqa" %}
[Broken mention](broken://pages/-M2UGXuZmTud5arO0Yqa)
{% endcontent-ref %}

{% content-ref url="/pages/-M2UJaz4R7mQ6PLoLy1d" %}
[Broken mention](broken://pages/-M2UJaz4R7mQ6PLoLy1d)
{% endcontent-ref %}

{% content-ref url="/pages/-M2UKNXpkADPOus1Q13G" %}
[Broken mention](broken://pages/-M2UKNXpkADPOus1Q13G)
{% endcontent-ref %}

{% content-ref url="/pages/-M2ULnH\_NdVo9oI98WIk" %}
[Broken mention](broken://pages/-M2ULnH_NdVo9oI98WIk)
{% endcontent-ref %}

{% content-ref url="/pages/-M2UMDQBjG4SCW30FWzV" %}
[Broken mention](broken://pages/-M2UMDQBjG4SCW30FWzV)
{% endcontent-ref %}

{% content-ref url="/pages/-MXqTku4Sv0gNZtB9FSc" %}
[Broken mention](broken://pages/-MXqTku4Sv0gNZtB9FSc)
{% endcontent-ref %}


# External Articles

External Useful Information

{% content-ref url="/pages/-Lw3mA4X68RjR1nMT7Lx" %}
[Broken mention](broken://pages/-Lw3mA4X68RjR1nMT7Lx)
{% endcontent-ref %}


# Step 1: Create Datahub Account

Register your company and get credentials for SDK Installation

{% hint style="danger" %}
**Important!**\
If you already have got a DataHub account, please, skip this step.

If you are a developer and you've received a link to this Developer Portal from your colleague, please, ask him to provide you with an access on **Company** or **Application** level to DataHub in order to avoid duplication of your company accounts.\
Here is the instruction how to provide an access:\
<https://docs.userdatahub.com/management/access-management>
{% endhint %}

To register your company please follow to [Company Account Registration](https://docs.userdatahub.com/) page in our DataHub user guide. You'll need to create an **Application** and **User Group** to get User Service Credentials (**InstanceKey**; **InstanceID**) for each user group within application to start the SDK integration process as well as work with API.

![User Service Credentials](/files/-MU8Ra6fit_kttdsR7Q9)


# Get started

{% content-ref url="/pages/-Ltcg7-HnUisG03DV4Pp" %}
[iOS SDK installation](/sdk-installation/ios-sdk-intallation)
{% endcontent-ref %}

{% content-ref url="/pages/-LtciezWgWzbv9hUS\_1v" %}
[Android SDK installation](/sdk-installation/android-sdk-installation)
{% endcontent-ref %}

\*\*\*

{% content-ref url="/pages/-LtcgIB5HTHj29DYU-sx" %}
[iOS SDK Changelog](/sdk-installation/changelog/ios-changelog)
{% endcontent-ref %}

{% content-ref url="/pages/-LtcgNhwFQ2VrJxf\_Kl-" %}
[Android SDK Changelog](/sdk-installation/changelog/android-changelog)
{% endcontent-ref %}


# iOS SDK installation

{% content-ref url="/pages/-Ltcj6hm6HU0gTT20miI" %}
[\*Set up Your Development Environment](/sdk-installation/ios-sdk-intallation/set-up-your-development-environment)
{% endcontent-ref %}

{% content-ref url="/pages/-LtcjFoDfyCZ-PB1hMrA" %}
[\*Configure Your Project](/sdk-installation/ios-sdk-intallation/configure-your-project)
{% endcontent-ref %}

{% content-ref url="/pages/-LtcjU2m76Qy0-wX2rFo" %}
[\*Configure Framework](/sdk-installation/ios-sdk-intallation/configure-framework)
{% endcontent-ref %}

{% content-ref url="/pages/-Ltckk5f-FZNH2QFuA3r" %}
[Add statistics data to your ViewController](/sdk-installation/ios-sdk-intallation/add-statistics-data-to-your-viewcontroller)
{% endcontent-ref %}

{% content-ref url="/pages/-Ltckqr5vSvHV7pmGB-5" %}
[Add list of trips to your ViewController](/sdk-installation/ios-sdk-intallation/add-list-of-trips-to-your-viewcontroller)
{% endcontent-ref %}

{% content-ref url="/pages/-LtcjvyxQD7z5AAHdeKo" %}
[Broken mention](broken://pages/-LtcjvyxQD7z5AAHdeKo)
{% endcontent-ref %}

{% content-ref url="/pages/-Ltcjowiz2OH6R\_QXHU6" %}
[\*What’s different in iOS 13?](/sdk-installation/ios-sdk-intallation/whats-different-in-ios-13)
{% endcontent-ref %}


# \*Set up Your Development Environment

**Note: If you already use CocoaPods, you can skip this step**<br>

To always link to the most recent version, link to the RaxelPulse iOS framework with CocoaPods rather than downloading the framework itself.

* Navigate to your project folder in a terminal window.&#x20;
* Make sure you have the [CocoaPods](https://cocoapods.org/?fbclid=IwAR0xys62erg3Z7E6T6HnQThCcoPHfMB4K5PW44aeORo1ja6u3jh4h0zMiEY) gem installed on your machine before installing the Raxel Pulse pod

This will create a file named "Podfile" in your project's root directory.

```
$ sudo gem install cocoapods
$ pod init
```

* Add the following to your Podfile:

```
pod 'RaxelPulse'
```

* Run the following command in your project root directory from a terminal window:

```
$ pod install
```


# \*Configure Your Project

Please check RaxelPulse target in pod\
`Always` Embed Swift Standard Libraries: NO

![](https://lh6.googleusercontent.com/a2G7PELxmDY8HllT9_qE4S_aCYpL5w2Ft9BOqHcdsX4ZhZI5n1-H-vsXrA2jEP4UVqMVqhwHfaxVvHmN9EjjZalnYpMz2ReXEPdnGKnddTF_SmIVVJOYF__F9OS7WQ)

Use this in your project target \
`Always Embed Swift Standard Libraries: YES`<br>

Configure the information property list file (Info.plist) with an XML snippet that contains data about your app.\
Right-click info.plist, and choose Open As Source Code. Add capabilities for privacy, motion usage etc.

```
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>Your explanation.</string>
<key>NSLocationAlwaysUsageDescription</key>
    <string>Your explanation.</string>
<key>NSLocationWhenInUseUsageDescription</key>
    <string>Your explanation.</string>
<key>NSMotionUsageDescription</key>
    <string>Your explanation.</string>
```

Background mode:

```
<key>UIBackgroundModes</key>
	<array>
		<string>fetch</string>
		<string>location</string>
		<string>remote-notification</string>
	</array>
```

The most popular explanation is: ***We are using location services to determine your driving style.***\
\
Add App Delegate initialisation methods and delegate methods \
*you should replace \<your token> with your virtual device token without pointy brackets. If you didn't build your token farm, you can request test token with curl using example below or follow to* [***Step 2***](https://docs.telematicssdk.com/project-setup/manage-service/user-registration)

```
curl -X POST "https://user.telematicssdk.com/v1/Registration/create" -H "accept: */*" -H "InstanceId: " -H "InstanceKey: " -H "Content-Type: application/json-patch+json" -d "{}"
```

{% hint style="info" %}
For product "Platform" please add email as a parameter. Email is an mandatory field which will be used as a login.&#x20;

For Telematics SDK product no fields are mandatory. you can use a code above to generate a token.

**Format:**\
"InstanceId: 5494...584"\
"InstanceKey: 4908...604 "&#x20;
{% endhint %}


# \*App Delegate

Provided methods included sdk to app lifecycle and garantee background correct work.

Objective-c

```
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [[RPPermissionsWizard returnInstance] launchWithFinish:^(BOOL showWizzard) {
        [RPEntry initializeWithRequestingPermissions:YES]; // Yes, if you don’t want to implement requesting by yourself

        [RPEntry instance].disableTracking = NO;
        [RPEntry application:application didFinishLaunchingWithOptions:launchOptions];
    }];
}
```

Swift:&#x20;

```
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    RPPermissionsWizard.returnInstance().launch(finish: { _ in
        RPEntry.initialize(withRequestingPermissions: true)
        let token = NSString(string: "Please, enter your Token")
        RPEntry.instance().virtualDeviceToken = token
        let options = launchOptions ?? [:]
        RPEntry.application(application, didFinishLaunchingWithOptions: options)
    })
    return true
}
```

**Implement AppDelegate methods**

Objective-c:

```
- (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(nonnull NSString *)identifier completionHandler:(nonnull void (^)(void))completionHandler {
    [RPEntry application:application handleEventsForBackgroundURLSession:identifier completionHandler:completionHandler];
}

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
    [RPEntry applicationDidReceiveMemoryWarning:application];
}

- (void)applicationWillTerminate:(UIApplication *)application {
    [RPEntry applicationWillTerminate:application];
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    [RPEntry applicationDidEnterBackground:application];
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    [RPEntry applicationDidBecomeActive:application];
}

- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
    [RPEntry application:application performFetchWithCompletionHandler:^{
        completionHandler(UIBackgroundFetchResultNewData);
    }];
}
```

Swift:

```
func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void) {
    RPEntry.application(application, handleEventsForBackgroundURLSession: identifier, completionHandler: completionHandler)
}

func applicationDidReceiveMemoryWarning(_ application: UIApplication) {        RPEntry.applicationDidReceiveMemoryWarning(application)
}

func applicationWillTerminate(_ application: UIApplication) {
    RPEntry.applicationWillTerminate(application)
}

func applicationDidEnterBackground(_ application: UIApplication) {
    RPEntry.applicationDidEnterBackground(application)
}

func applicationDidBecomeActive(_ application: UIApplication) {
    RPEntry.applicationDidBecomeActive(application)
}

func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    RPEntry.application(application) {
        completionHandler(.newData)
    }
}
```


# \*Configure Framework

### Set up Device Token (Log in)/ Remove Device Token (Log out)

```
if ([self userIsAuthenticated]) {
    [RPEntry instance].virtualDeviceToken = [self getDeviceToken];
} else {
    /// empty device token is not allowed
    /// Use removeVirtualDeviceToken method for log out from the host app.
    [[RPEntry instance] removeVirtualDeviceToken];
}
```

{% hint style="danger" %}
You can't set empty or nil token
{% endhint %}

{% hint style="danger" %}
Use removeVirtualDeviceToken method when the user logs out from the host app.
{% endhint %}

### Enable and disable Tracking (Optional)

If you want to disable or enable tracking, you can use property disableTracking of RPEntry class

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
[RPEntry instance].disableTracking = NO;  //enable tracking
[RPEntry instance].disableTracking = YES; //disable tracking
```

{% endtab %}

{% tab title="Swift" %}

```swift
RPEntry.instance().disableTracking = NO;  //enable tracking
RPEntry.instance().disableTracking = YES; //disable tracking
```

{% endtab %}
{% endtabs %}

### Enable and disable SDK (Optional)

Disable tracking doesn't disable SDK and it continues to send heartbeats (:point\_right: [Dataset](https://docs.telematicssdk.com/platform-features/heartbeats#fields-dictionary)). If you want to completely disable SDK, you should remove the Device Token

{% hint style="danger" %}
You can't set an empty or nil token
{% endhint %}

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
[RPEntry instance].disableTracking = YES;           //disable tracking
[[RPEntry instance] removeVirtualDeviceToken];      //remove token. 
```

{% endtab %}

{% tab title="Swift" %}

```swift
RPEntry.instance().disableTracking = YES;           //disable tracking
RPEntry.instance().removeVirtualDeviceToken();      //remove token. 
```

{% endtab %}
{% endtabs %}

### Enable Bluetooth OBD/ELM Functionality

Bluetooth OBD/ELM functionality enables the host app to work with Bluetooth OBD devices to get in-vehicle data (:point\_right:[Dataset](https://docs.telematicssdk.com/product-description/dataset/dataset-decription/bluetooth-obd)). To enable this, please use the method below:

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
[RPEntry enableELM:true]; 
```

{% endtab %}

{% tab title="Swift" %}

```swift
RPEntry.enableELM(true)
```

{% endtab %}
{% endtabs %}

### Enable high-frequency data collection (Accurate and persistent dataset)

{% hint style="info" %}
We strongly recommend keeping it enabled by default
{% endhint %}

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
[RPEntry enableHF:true];
```

{% endtab %}

{% tab title="Swift" %}

```swift
RPEntry.enableHF(true)
```

{% endtab %}
{% endtabs %}

### Enable Advertisement identifier

To enable Ads identifier, should provide Advertisement identifier to SDK. Please add these lines near the code from the previous section. Make sure, you added `import` section

**`#import <AdSupport/AdSupport.h>`**

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
if ([ASIdentifierManager sharedManager].isAdvertisingTrackingEnabled) {
    [RPEntry instance].advertisingIdentificator = [ASIdentifierManager sharedManager].advertisingIdentifier;
}
```

{% endtab %}

{% tab title="Swift" %}

```swift
if (ASIdentifierManager.shared().isAdvertisingTrackingEnabled) {
    RPEntry.instance().advertisingIdentifier = ASIdentifierManager.shared().advertisingIdentifier
}
```

{% endtab %}
{% endtabs %}


# \*React Native Installation

**Note: If you already use CocoaPods, you can skip this step**

To always link to the most recent version, link to the RaxelPulse iOS framework with CocoaPods rather than downloading the framework itself.

* Navigate to your project folder in a terminal window.
* Make sure you have the [CocoaPods](https://cocoapods.org/?fbclid=IwAR0xys62erg3Z7E6T6HnQThCcoPHfMB4K5PW44aeORo1ja6u3jh4h0zMiEY) gem installed on your machine before installing the Raxel Pulse pod

This will create a file named "Podfile" in your project's root directory.

```
$ sudo gem install cocoapods$ pod init
```

* Add the following to your Podfile:

```
pod 'RaxelPulse'
```

* Run the following command in your project root directory from a terminal window:

```
$ pod install
```

[<br>](https://docs.telematicssdk.com/sdk-installation/ios-sdk-intallation)


# Create the iOS bridge

Create the native files for your module by opening your workspace file on Xcode, select your project, and right-click to add a new file. Select *Cocoa Touch Class,* give the name, and create it.&#x20;

### Step 1 - `BridgeClassDemo.h`

Create the bridge by copying the code below into your `BridgeClassDemo.h` file&#x20;

{% code title="BridgeClassDemo.h" %}

```swift
//
//  BridgeClassDemo.h
//  RaxelPulseReactNativeDemo
//
//  Created by Sergey Emelyanov on 19/04/2020.
//  Copyright © 2020 Data motion Pte.Ltd. All rights reserved.
//  https://telematicssdk.com

#import "React/RCTBridgeModule.h"

// Instead of BridgeClassDemo put the name of your module
@interface BridgeClassDemo : NSObject <RCTBridgeModule>
@end
```

{% endcode %}

### Step 2 - `DemoClass.m`

Add the code below into your `DemoClass.m` file:

{% code title="DemoClass.m" %}

```swift
//
//  BridgeClassDemo.m
//  RaxelPulseReactNativeDemo
//
//  Created by Sergey Emelyanov on 19/04/2020.
//  Copyright © 2020 Data motion Pte.Ltd. All rights reserved.
//  https://telematicssdk.com

#import <React/RCTLog.h>
#import <RaxelPulse/RaxelPulse.h>
#import <AdSupport/AdSupport.h>
#import "BridgeClassDemo.h" // Here put the name of your module

@implementation BridgeClassDemo // Here put the name of your module

// This RCT (React) "macro" exposes the current module to JavaScript

RCT_EXPORT_MODULE(BridgeClassDemo);

RCT_EXPORT_METHOD(start:(NSString *)token) {
  dispatch_async(dispatch_get_main_queue(), ^{
    [RPEntry instance].virtualDeviceToken = @"DeviceToken";
    [RPEntry instance].disableTracking = NO;
  });
}

RCT_EXPORT_METHOD(enableSDK) {
  dispatch_async(dispatch_get_main_queue(), ^{
      [[RPEntry instance] setEnableSdk: true];
  });
}

RCT_EXPORT_METHOD(disableSDK) {
  dispatch_async(dispatch_get_main_queue(), ^{
      [[RPEntry instance] setDisableWithUpload];
  });
}

/** You can add any required methods by yourself 
* using this code as a template

RCT_EXPORT_METHOD(yourmetod) {
  dispatch_async(dispatch_get_main_queue(), ^{
      //Your native command
  });
}

*/

@end
```

{% endcode %}

### Step 3 - AppDelegate

Handle library methods for AppDelegate as it is in the example below:

```java
#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTRootView.h>
#import <RaxelPulse/RaxelPulse.h>
#import <React/RCTLog.h>
#import <AdSupport/AdSupport.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [[RPCPermissionsWizard returnInstance] launchWithFinish:^(BOOL showWizzard) {
    [RPEntry initializeWithRequestingPermissions:YES];
  }];
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
    moduleName:@"RCdemo_mobile"
    initialProperties:nil];
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  return YES;
}
  
- (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(nonnull NSString *)identifier completionHandler:(nonnull void (^)(void))completionHandler {
  [RPEntry application:application handleEventsForBackgroundURLSession:identifier completionHandler:completionHandler];
}
  
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
  [RPEntry applicationDidReceiveMemoryWarning:application];
}
  
- (void)applicationWillTerminate:(UIApplication *)application {
  [RPEntry applicationWillTerminate:application];
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
  [RPEntry applicationDidEnterBackground:application];
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
  [RPEntry applicationDidBecomeActive:application];
}

- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
  [RPEntry application:application performFetchWithCompletionHandler:^{
    completionHandler(UIBackgroundFetchResultNewData);
  }];
}

@end
```

And that’s it for the native side.&#x20;

### Step 4 - React Native side

We can now call it anywhere on the React Native side:

```java
import { NativeModules } from 'react-native';
var BridgeClassDemo = NativeModules.BridgeClassDemo;
//Let's show it
BridgeClassDemo.start(@"DeviceToken")
BridgeClassDemo.enableSDK()
BridgeClassDemo.disableSDK()
//BridgeClassDemo.yourmetod()
```


# Add list of trips to your ViewController

You need to perform async request to get completed tracks:

Objective-c:

```
- (void)loadTracks {
    [[RPEntry instance].api getTracksWithOffset:0 limit:100 completion:^(id response, NSError *error) {
        if (error != nil) {
            return;
        }
        
        if (![response isKindOfClass:[RPFeed class]]) {
            return;
        }
        
        RPFeed *feed = response;
        NSArray <RPTrackProcessed *> *tracks = feed.tracks;
 
        dispatch_async(dispatch_get_main_queue(), ^{
     /// Implement updating your ViewController with new data            
        });
 
 
    }];
}
```

Swift:&#x20;

```
func loadTracks() {
    RPEntry.instance().api.getTracks(0, limit: 100) { (response, error) in
        if let feed = response as? RPFeed {
            let tracks = feed.tracks;
            DispatchQueue.main.async {
                /// Implement updating your ViewController with new data
            }
        }
        if (error != nil) {
            DispatchQueue.main.async {
                /// Implement alert or logging
            }
        }
    }
}
```


# Add statistics data to your ViewController

You need to perform async request to get user statistics:

```
- (void)loadData {    
    [[RPEntry instance].api getStatisticsMainWithCompletion:^(id response, NSError *error) {
        if (error != nil) {
            return;
        }
        
        if (![response isKindOfClass:[RPStatistics class]]) {
            return;
        }
  /// Implement updating your ViewController with new data        
    }];
}
```


# \*What’s different in iOS 13?

### How did location permissions work prior to iOS 13?

This document provides information about working with the first versions of iOS 13.

There are several new features in iOS 13, but only one appears relevant to the functionality of Telematics SDK. This new feature involves changing the way apps request location permissions.

Prior Apple iOS versions provided three initial options for apps requesting location services:

* Only While Using the App
* Always Allow
* Don’t Allow

Telematics SDK requires location services be set to **Always Allow**. This enables apps using Telematics SDK to successfully record trips while running in the background (that is, when the app is not visibly open on the user’s phone screen).

### How do we currently handle iOS location permissions?

During the initial setup of our apps on iOS 12 and earlier, the app encourages and guides the user to select the required **Always Allow** option:

Prior to being prompted by the OS, users see a screen letting them know they should select the “Always” option.

![](https://lh5.googleusercontent.com/88lPN9JbT2rWOC9YjVB7dUc1R0MnYahEOuTkjt06H10snnQ2wLz6y68e9WkKp4iJsAk-ia9KI-Zt7Ea7bhcP3C0XmIqNfTNM23t0C7O5S6ah0WtkB83SKSALLvBDlw)![](https://lh3.googleusercontent.com/nGHFb2VZztBp-YwVwCXlbGSys8Sb28LT0CjAnXr-NFNqzaX80Qpiwd9V1XEIeatyCJnfofHj7JVJqdenuRQNeJN7M3HlPw4c7FZF3oYcYRuWNMJomzDUCbgxnqGU4g)![](https://lh3.googleusercontent.com/Wc0speuLTffG9cnNnJpjp49LMV9vGuzsnBOV_bGVvOkaMvFG7focztECfcZT4xf15WHTUih6jkJ_X1hyexyyp0UaTwvGB2MTDlj7liEQe7ra-nY-UGFm9LH_0CLipw)

### How do location permissions change in iOS 13?

In iOS 13, the OS still provides three options for specifying location\
permissions when a user install a Telematics SDK app. However,\
these initial options are different from prior iOS releases and do not include an\
**Always Allow** option, which is required for the app to record trips in the\
background.

The following table shows the location permission options provided in iOS 13

Beta 5 compared to earlier versions.

| iOS 12 (and earlier)     | iOS 13                |
| ------------------------ | --------------------- |
| Only While Using the App | Allow While Using App |
| Always Allow             | Allow Once            |
| Don’t Allow              | Don’t Allow           |

The user is prompted at a later time, potentially a few days after installation,

about whether to allow “always” permissions for the app.

### What’s the impact on current Telematics SDK app users?<br>

![](https://lh5.googleusercontent.com/5LV3TvKaYjFJw78wVhu5TzhOjQQ33NpIMmivVR6vCJP6iS6BIDD3CHame1-CLc32RwAOoqOYOlZYo8gmY5TigED1mpBij8I2Ph8L3t35jrB85P-5BoWkSPX9XqCm8w)

Users currently running a Telematics SDK app will retain their prior **Always Allow** location permissions setting when upgrading to iOS 13. As with earlier iOS versions, the user is occasionally asked to allow the app to use location services while running in the background. However, the iOS 13 Beta 5 confirmation pop-up looks different from past iOS releases in that it displays a map of location data recently collected by the app.


# \*iOS 13 Permissions Wizard

Integration needed

New call

Implemented new class RPPermissionsWizard. Please, call it instance by returnInstance and use launchWithFinish for Objective-c or launch for Swift method with callback.

Objective-c:

```
[[RPPermissionsWizard returnInstance] launchWithFinish:^(BOOL showWizzard) {
}];
```

Swift:

```
RPPermissionsWizard.returnInstance().launch(finish: { showWizzard in
})
```

### Add all setup call of RaxelPulse SDK to callback method

Objective-c:

```
[[RPPermissionsWizard returnInstance] launchWithFinish:^(BOOL showWizzard)
 {        [RPEntry initializeWithRequestingPermissions:YES];
        [RPEntry instance].virtualDeviceToken = @"_____";
        .... etc
    }];
```

Swift:

```
RPPermissionsWizard.returnInstance().launch(finish: { _ in
            RPEntry.initialize(withRequestingPermissions: true)
            let token = NSString(string: "______")
            RPEntry.instance().virtualDeviceToken = token
            let options = launchOptions ?? [:]
            RPEntry.application(application, didFinishLaunchingWithOptions:
options)
            .... etc
        })
```

### Add Push Notifications call to this call back after init of RaxelPulse

Objective-c:

```
[[RPPermissionsWizard returnInstance] launchWithFinish:^(BOOL showWizzard) {
        [RPEntry initializeWithRequestingPermissions:YES];
        [RPEntry instance].virtualDeviceToken = @"_____";
        .... etc
    }];
```

Swift:

```
RPPermissionsWizard.returnInstance().launch(finish: { _ in
            RPEntry.initialize(withRequestingPermissions: true)
            let token = NSString(string: "______")
            RPEntry.instance().virtualDeviceToken = token
            let options = launchOptions ?? [:]
            RPEntry.application(application, didFinishLaunchingWithOptions:
options)
            .... etc
        })
```

**or you can use RPPermissionsWizard handlers**

Objective-c:

```
[[RPPermissionsWizard returnInstance] setupHandlersWithUserNotificationResponce:^(BOOL granted, NSError * _Nullable error) {
        if (error != nil) {
            NSLog(@"error while requesting notification permission. Error code
%li, error description %@",
                  error.code, error.description);
        }
        NSLog(@"receiving notification is granted: %d", granted);
    } motionManagerResponce:^(BOOL granted, NSError * _Nullable error) {
        NSLog(@"receiving motion is granted: %d", granted);
    } locationManagerResponce:^(CLAuthorizationStatus status) {
        NSLog(@"receiving location status: %d", status);
    }];
```

Swift:

```
              RPPermissionsWizard.returnInstance().setupHandlers(
                    userNotificationResponce: { (granted, error) in
                        DispatchQueue.main.async {
                            if granted {
                             UIApplication.shared.registerForRemoteNotifications()
                                observer.onNext(true)
                            } else {
                                observer.onNext(false)
                            }
                            observer.onCompleted()
                        }
                },
                    motionManagerResponce: { (granted, error) in
                },
                    locationManagerResponce: { (status) in
                })
```

#### Required Permissions Granted

Added isAllRequiredPermissionsGranted property for get state of SDK permissions needed. \
Objective-c:&#x20;

```
BOOL isAllFine = RPEntry.isAllRequiredPermissionsGranted()
```

Swift:&#x20;

```
BOOL isAllFine = [RPEntry isAllRequiredPermissionsGranted]; 
```

### Permissions Wizard Customisation

If you not changed next property Wizard used default values from itself.

Implemented new class RPSettings. Please, call it instance by returnInstance and use property:

wizardBgColor - background color of screen view

wizardMaintextColor - main text color

wizardAlertTextColor - main text color in example alert

wizardAlertButtonColor - button text color in alert

wizardAlertActiveButtonColor - active button text color in alert

wizardAlertActiveButtonBgColor - active button background color in alert

wizardAlertCorners - alert corner radius in CGFloat

Default Values:

**.White**

```
public var wizardBgColor                 : UIColor = UIColor.groupTableViewBackground
public var wizardMaintextColor           : UIColor = UIColor.black
public var wizardAlertBackgroundColor    : UIColor = UIColor.white
public var wizardAlertTextColor          : UIColor = UIColor(hex: "6F8593")
public var wizardAlertButtonTextColor    : UIColor = UIColor(hex: "0984ff")
public var wizardAlertActiveButtonTextColor: UIColor = UIColor.white
public var wizardAlertActiveButtonBgColor : UIColor = UIColor(hex: "FF9300")
public var wizardAlertCorners             : CGFloat = 7.0
public var wizardNextButtonBgColor        : UIColor = UIColor(red:
0.10980392156862745, green: 0.10980392156862745, blue: 0.11764705882352941,
alpha: 1.0)
public var wizardNextButtonTextColor      : UIColor = UIColor.white
```

**.Dark worked only when you not customising following alert colors:**

*wizardAlertBackgroundColor*\
*wizardAlertTextColor*\
*wizardAlertActiveButtonBgColor*

**.Dark style used next Default:**

```
wizardAlertBackgroundColor = UIColor(red: 0.17254901960784313, green: 0.17254901960784313, blue: 0.1803921568627451, alpha: 1.0)
wizardAlertTextColor = UIColor.white
wizardAlertActiveButtonBgColor = UIColor(hex: "8e8e93")
wizardAlertActiveButtonTextColor = UIColor(hex: "0984ff")
```

#### **How to use Settings:**

Objective-c:

```
[RPSettings returnInstance].wizardAlertActiveButtonBgColor = 
  [UIColor colorWithRed: 0.79 
           green       : 0.22 
           blue        : 0.17 
           alpha       : 1.0];
```

Swift:

```
RPSettings.returnInstance.wizardAlertActiveButtonBgColor = UIColor.red
```

#### Custom text on Wizard pages:

Objective-c:

```
NSMutableAttributedString *firstButton = [[NSMutableAttributedString alloc] initWithString:@"Ok"];

NSMutableAttributedString *secondButton = [[NSMutableAttributedString alloc] initWithString:@"Cancel"];

NSArray<NSMutableAttributedString *> *buttonsList = [[NSArray alloc] initWithObjects:firstButton, secondButton, nil];

RPPageTexts *whileInUsePage = [[RPPageTexts alloc] initWithPageText:[[NSMutableAttributedString alloc] initWithString:@"Attention Required!\n\nYou will receive a popup shortly. This popup will aks you for access to your location even when you are not using the app.\n\nPlease, choose “Always While Using App” for <appName> to automatically detect when you start a trip."] alertText:[[NSMutableAttributedString alloc] initWithString:@"Allow <appName> to access your location?\n\nWe use location service for evaluating your driving manner. Be enabling “Always While Using App” on location, the app will be able to automatically determine when you have started and ended a drive"] buttonsText:buttonsList selected:1];

RPPageTexts *motionPage = [[RPPageTexts alloc] initWithPageText:[[NSMutableAttributedString alloc] initWithString:@"Attention Required!\n\nThen, You will receive a popup to grant us access to your Motion & Fitness activity. We need this information to create a driving score.\n\nPlease, choose “OK” for <appName> to grant us access to Motion & Fitness activity."] alertText:[[NSMutableAttributedString alloc] initWithString:@"<appName> Would Like to Access Your Motion & Fitness Activity\n\nWe use motion sensors for evaluating your driving manner"] buttonsText:buttonsList selected:1];

RPPageTexts *pushPage = [[RPPageTexts alloc] initWithPageText:[[NSMutableAttributedString alloc] initWithString:@"Attention Required!\n\nAs the next step, You will receive a popup to grant us rights to send you important notifications. You are always able to turn off notifications by categories in the App settings menu.\n\nPlease, choose “Allow” for <appName> to keep you informed on important events."] alertText:[[NSMutableAttributedString alloc] initWithString:@"<appName> Would Like to Send You Notifications\n\nNotifications may include alerts, sounds and icon badges. These can be configured in Settings"] buttonsText:buttonsList selected:1];

RPPageTexts *alwaysPage = [[RPPageTexts alloc] initWithPageText:[[NSMutableAttributedString alloc] initWithString:@"Attention Required!\n\nYou will receive a popup shortly for <appName> to have access to your location even when you are not using the app.\n\nFor the app to work properly\n“Change to Always Allow”"] alertText:[[NSMutableAttributedString alloc] initWithString:@"Allow <appName> to also access your location even when you are not using the app?\n\nWe use location service for generating a driving score. Be enabling “Always” on location, the app will be able to automatically determine when you have started and ended a drive"] buttonsText:buttonsList selected:1];

NSArray<RPPageTexts *> *customPages = [[NSArray alloc] initWithObjects:whileInUsePage, motionPage, pushPage, alwaysPage, nil];

[RPSettings returnInstance].wizardPages = customPages;
```

Swift:

```
let whileInUsePage = RPPageTexts(pageText: NSMutableAttributedString(string: "Attention Required!\n\nYou will receive a popup shortly. This popup will aks you for access to your location even when you are not using the app.\n\nPlease, choose “Always While Using App” for <appName> to automatically detect when you start a trip."), alertText: NSMutableAttributedString(string: "Allow <appName> to access your location?\n\nWe use location service for evaluating your driving manner. Be enabling “Always While Using App” on location, the app will be able to automatically determine when you have started and ended a drive"), buttonsText: [NSMutableAttributedString(string: "Always While Using App”), NSMutableAttributedString(string: "Allow Once”), NSMutableAttributedString(string: "Don’t Allow”)], selected: 0)

let motionPage = RPPageTexts(pageText: NSMutableAttributedString(string: "Attention Required!\n\nThen, You will receive a popup to grant us access to your Motion & Fitness activity. We need this information to create a driving score.\n\nPlease, choose “OK” for <appName> to grant us access to Motion & Fitness activity."), alertText: NSMutableAttributedString(string: "<appName> Would Like to Access Your Motion & Fitness Activity\n\nWe use motion sensors for evaluating your driving manner"), buttonsText: [NSMutableAttributedString(string: "Don’t Allow”), NSMutableAttributedString(string: "OK”)], selected: 1)

let pushPage = RPPageTexts(pageText: NSMutableAttributedString(string: "Attention Required!\n\nAs the next step, You will receive a popup to grant us rights to send you important notifications. You are always able to turn off notifications by categories in the App settings menu.\n\nPlease, choose “Allow” for <appName> to keep you informed on important events."), alertText: NSMutableAttributedString(string: "<appName> Would Like to Send You Notifications\n\nNotifications may include alerts, sounds and icon badges. These can be configured in Settings"), buttonsText: [NSMutableAttributedString(string: "Don’t Allow”), NSMutableAttributedString(string: "Allow”)], selected: 1)

let alwaysPage = RPPageTexts(pageText: NSMutableAttributedString(string: "Attention Required!\n\nYou will receive a popup shortly for <appName> to have access to your location even when you are not using the app.\n\nFor the app to work properly\n“Change to Always Allow”"), alertText: NSMutableAttributedString(string: "Allow <appName> to also access your location even when you are not using the app?\n\nWe use location service for generating a driving score. Be enabling “Always” on location, the app will be able to automatically determine when you have started and ended a drive"), buttonsText: [NSMutableAttributedString(string: "Keep Only While Using”), NSMutableAttributedString(string: "Change to Always Allow”)], selected: 1)

RPSettings.returnInstance().wizardPages = [whileInUsePage, motionPage, pushPage, alwaysPage]
```


# \*SDK Enable \ Disable \ Disable With Upload

SDK could be switched on\off and get state now

SDK could be switched on\off and get state now

-(void)setEnableSdk:(BOOL)value;

-(void)setDisableWithUpload;

+(BOOL)isSDKEnabled;

\
**Usage examples:**

for disable sdk and upload tracks you need to use

```
[[RPEntry instance] setDisableWithUpload];
```

To enable sdk you need to use

```
[[RPEntry instance] setEnableSdk:true];
```

To check sdk state, please use

```
[RPEntry isSDKEnabled];
```

{% hint style="danger" %}
**Attention!!! Don’t remove DeviceToken because it used for upload tracks!**
{% endhint %}


# \*Incoming Tags

### Added incoming tags

You can set tags to Incoming then all tracks received after installing TAGS will be marked with these tags. Here the binding is done on a person (deviceToken). You can add, remove, and get a list of installed tags on IncomingTags for enriched trips these are the same tags as on Incoming but already linked to a specific track. You can also delete, add, and get Tags already linked to a specific track.

* (**void**)addFutureTrackTag:(RPTag \*)tag completion:(RPAPIITagCallback)callback;
* (**void**)removeFutureTrackTag:(RPTag \*)tag completion:(RPAPIITagCallback)callback;
* (**void**)getFutureTrackTag:(NSInteger)timestamp completion:(RPAPIITagGCallback)callback;
* (**void**)removeAllFutureTrackTagsWithСompletion:(RPAPIITagWCallback)callback;

addFutureTrackTag example

1. with out completion:\
   \[\[RPEntry instance].api addFutureTrackTag:tag completion:nil];
2. with completion:\
   \[\[RPEntry instance].api addFutureTrackTag:tag completion:^(RPTagStatus status, RPTag \*tag, NSInteger timestamp) {}];

**Usage example:**

```
[[RPEntry instance].api addFutureTrackTag:tag completion:nil];
[[RPEntry instance].api addFutureTrackTag:tag completion:^(RPTagStatus status, RPTag *tag, NSInteger timestamp) {}];
[[RPEntry instance].api getFutureTrackTag:0 completion:^(RPTagStatus status, NSArray<RPTag *> *tags, NSInteger timestamp) {
    for (RPTag *item in tags) {
        NSLog(@"%@", item.tag);
    }
}];
[[RPEntry instance].api removeFutureTrackTag:tag completion:^(RPTagStatus status, RPTag *tag, NSInteger timestamp) {}];
[[RPEntry instance].api removeAllFutureTrackTagsWithСompletion:^(RPTagStatus status, NSInteger timestamp) {}];
```

Added new RPTagsServerStateDelegate for online and offline operation status logging\
RPTagStatus in this protocol

```
typedef NS_ENUM(NSUInteger, RPTagStatus) {
    SUCCESS, // success for add or delete
    OFFLINE, // app in offline and operation saved in local database
    ERROR_WRONG_TIME, // operation canceled by server with wrong time(time from future)
    ERROR_TAG_OPERATION // operation canceled by server as duplicated or incorrect
};
```

**Usage example:**

```
@interface MyListener () <RPTagsServerStateDelegate> {}
@end

@implementation MyListener

- (instancetype)init {
    self = [super init];
    if (self) {
        [RPEntry instance].tagStateDelegate = self;
    }
    return self;
}

- (void)addTag:(RPTagStatus)status tag:(RPTag *)tag timestamp:(NSInteger)timestamp {
    NSString *str = @"";
    switch (status) {
        case SUCCESS:
            str = @"success for add or delete";
            break;
            
        case OFFLINE:
            str = @"app in offline and operation saved in local database";
            break;
                  
        case ERROR_WRONG_TIME:
            str = @"operation canceled by server with wrong time(time from future)";
            break;
            
        case ERROR_TAG_OPERATION:
            str = @"operation canceled by server as duplicated or incorrect";
            break;
            
        default:
            break;
    }
    NSLog(@"%@ - %@ - %ld", str, tag.toJSON, timestamp);
}

- (void)deleteTag:(RPTagStatus)status tag:(RPTag *)tag timestamp:(NSInteger)timestamp {
    NSString *str = @"";
    switch (status) {
        case SUCCESS:
            str = @"success for add or delete";
            break;
            
        case OFFLINE:
            str = @"app in offline and operation saved in local database";
            break;
                  
        case ERROR_WRONG_TIME:
            str = @"operation canceled by server with wrong time(time from future)";
            break;
            
        case ERROR_TAG_OPERATION:
            str = @"operation canceled by server as duplicated or incorrect";
            break;
            
        default:
            break;
    }
    NSLog(@"%@ - %@ - %ld", str, tag.toJSON, timestamp);
}

- (void)getTags:(RPTagStatus)status tags:(id)tags timestamp:(NSInteger)timestamp {
    NSString *str = @"";
    switch (status) {
        case SUCCESS:
            str = @"success for add or delete";
            break;
            
        case OFFLINE:
            str = @"app in offline and operation saved in local database";
            break;
                  
        case ERROR_WRONG_TIME:
            str = @"operation canceled by server with wrong time(time from future)";
            break;
            
        case ERROR_TAG_OPERATION:
            str = @"operation canceled by server as duplicated or incorrect";
            break;
            
        default:
            break;
    }
    NSLog(@"%@ - %@ - %ld", str, tags, timestamp);
}

- (void)removeAll:(RPTagStatus)status timestamp:(NSInteger)timestamp {
    NSString *str = @"";
    switch (status) {
        case SUCCESS:
            str = @"success for add or delete";
            break;
            
        case OFFLINE:
            str = @"app in offline and operation saved in local database";
            break;
                  
        case ERROR_WRONG_TIME:
            str = @"operation canceled by server with wrong time(time from future)";
            break;
            
        case ERROR_TAG_OPERATION:
            str = @"operation canceled by server as duplicated or incorrect";
            break;
            
        default:
            break;
    }
    NSLog(@"%@ - %ld", str, timestamp);
}

@end
```


# \*Tracking Status

Check Tracking status with next\
Objective-c:

```
[RPTracker instance].isActive
```

Detect state changes with Notification:\
Objective-c:

```
[[NSNotificationCenter defaultCenter]
     addObserver:self
     selector:@selector(observeTracker)
     name:RPTrackerDidChangeActivityNotification
     object:nil];
```

and Observer\
Objective-c:

```
- (void)observeTracker {
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        self.startButton.enabled = ![RPTracker instance].isActive;
        self.stopButton.enabled = [RPTracker instance].isActive;
        
        if ([RPTracker instance].isActive) {
            self.tokenLabel.text = @"tracking is active";
        } else {
            self.tokenLabel.text = @"tracking is not active";
        }
    });
}
```

Detect state changes with Delegate:\
**RPTrackingStateListenerDelegate**\
Objective-c:

```
@interface AppDelegate () <RPSpeedLimitDelegate, RPTrackingStateListenerDelegate> {
    
}

@end
```

Delegate Method\
Objective-c:

```
- (void)trackingStateChanged:(Boolean)state {
    NSLog(@"tracking state changed to %hhu", state);
}
```

### Start / Stop Tracking&#x20;

Manual start and stop tracking don't switch off automatic start / stop tracking. For manual start track you could use:

```
[[RPTracker instance] startTracking];
```

For manual stop track you could use:

```
[[RPTracker instance] stopTracking];
```


# \*SDK Delegates

{% hint style="info" %}
Applicable for SDK version 5.9.5 and higher
{% endhint %}

## RPLocationDelegate

Usage example:

```
@interface AppDelegate () <RPLocationDelegate> {
        [RPEntry instance].locationDelegate = self;
}
```

Delegate method:

```
- (void)onLocationChanged:(CLLocation *)location {
    // Enter your code here to use location objectfrom SDK
}

- (void)onNewEvents:(NSMutableArray *)events {
    for (RPEventPoint *temp in events) {
        NSString *tempString = self.loggerView.text;
        tempString = [NSString stringWithFormat:@"%@\n%@", tempString, temp.type];
        dispatch_async(dispatch_get_main_queue(), ^{
            [self.loggerView setText:tempString];
        });
    }
}
```

{% hint style="info" %}
Applicable for SDK version 5.8.0 and higher
{% endhint %}

## **RP**LowPowerMode**Delegate**

Usage exameple:

```
@interface AppDelegate () <RPLowPowerModeDelegate> {
        [RPEntry instance].lowPowerModeDelegate = self;
}
```

Delegate method:

```
- (void)lowPowerMode:(Boolean)state {
    if (state) {
        // You can create push in this place and fire about this, as example 
        
        UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
        content.title = @"Low Power Mode";
        content.body = [NSString stringWithFormat:@"Your trips may be not recorded. Please, follow to Settings=>Battery=>Low Power"];
        UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:1 repeats:NO];
        UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:@"overspeed" content:content trigger:trigger];

        [[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:request withCompletionHandler:nil]; 
    }
}
```

## **RP**AccuracyAuthorization**Delegate**

Usage example:

```
@interface AppDelegate () <RPAccuracyAuthorizationDelegate> {
        [RPEntry instance].accuracyAuthorizationDelegate = self;
}
```

Delegate method:

```
- (void)wrongAccuracyAuthorization {
    // You can create push in this place and fire about this, as example 
        
    UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
    content.title = @"Precise Location is off";
    content.body = [NSString stringWithFormat:@"Your trips may be not recorded. Please, follow to App Settings=>Location=>Precise Location"];
    UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:1 repeats:NO];
    UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:@"overspeed" content:content trigger:trigger];

    [[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:request withCompletionHandler:nil];

}
```

{% hint style="info" %}
Applicable for SDK version 5.7.0 and higher
{% endhint %}

## **RPLocationDelegate**

Usage example:

```
@interface AppDelegate () <RPLocationDelegate> {
        [RPEntry instance].locationDelegate = self;
}
```

Delegate method:

```
- (void)onLocationChanged:(CLLocation *)location {
    // Enter your code here to use location objectfrom SDK
}
```


# \*SDK Modes

{% hint style="info" %}
Applicable for SDK version 5.9.0 and higher
{% endhint %}

#### SDK can work in two modes now:

**Aggressive** - [heartbeats](/platform-features/heartbeats) are sent every 20 minutes and SDK never sleeps.&#x20;

**Normal** - [heartbeats](/platform-features/heartbeats) are sent every 20 minutes but when system suspends SDK, it gees to a sleep mode and will restore work only in trip start time.

Mode switcher \
\- (**void**)setAggressiveHeartbeats:(**BOOL**)value;\
usage example:

```
[[RPEntry instance] setAggressiveHeartbeats: false];
```

Check state \
\- (**BOOL**)aggressiveHeartbeat; \
usage example:

```
[[RPEntry instance] aggressiveHeartbeat];
```


# \*Using the Debugging Tools in Simulator

Access the debugging tools in Simulator through the Location menu

| Location | <p>Allows you to set the Core Location to be used by your app. Choose from the different location settings:</p><ul><li><strong>None.</strong> Does not return a location. Use for testing how an app responds when no location data is available. A simulated watchOS device asks the paired iPhone for the location.</li><li><strong>Custom Location.</strong> Allows use of a custom latitude and longitude.</li><li><strong>Apple.</strong> Uses the coordinates of the Apple Headquarters.</li><li><strong>City Bicycle Ride.</strong> Simulates a bike ride in Cupertino, CA. This item simulates the device moving on a predefined route.</li><li><strong>City Run.</strong> Simulates a run in Cupertino, CA. This item simulates the device moving on a predefined route.</li><li><strong>Freeway Drive.</strong> Simulates a drive through Cupertino, CA. This item simulates the device moving on a predefined route.<br></li></ul> |
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

{% embed url="<https://www.youtube.com/watch?v=jReqV33QCPc>" %}

### Track finalize

Set location(Apple) after you end simulation drive and wait for 5 min + time for upload track. When sdk detects no move in 4 minutes it finalizes track and uploads data to server.

### Simulate track with next manual:&#x20;

1\. Setup app \
2\. Complete permissions wizard \
3\. Close app (don't delete) \
4\. Launch app \
5\. Start freeway drive at simulator \
6\. Set Apple position at simulator \
7\. Wait for DataHub increment for received tracks count and for increment processed or invalid tracks\
**If you want several trip - make it but at the end of last make this:** \
1\. Set Apple position at simulator \
2\. Wait for DataHub increment for received tracks count and for increment processed or invalid tracks \
**If tracks don't upload by the long time:** \
1\. Close app (don't delete) \
2\. Launch app, monitor trips on device and in DataHub\
**When you see permissions wizard your app has clean install without any data in storage.**


# Android SDK installation

{% content-ref url="/pages/-Ltcle3AhsTFi97-2roW" %}
[\*Getting started](/sdk-installation/android-sdk-installation/setup-and-enabling-sdk)
{% endcontent-ref %}

{% content-ref url="/pages/-MUnBEXyBTU-Nkfgkssc" %}
[\*Subscribe to tracking events](/sdk-installation/android-sdk-installation/subscribe-to-tracking-events)
{% endcontent-ref %}

{% content-ref url="/pages/-MUnJJ1y9DbCD7cY2vS8" %}
[\*Incoming tags managing](/sdk-installation/android-sdk-installation/incoming-tags-managing)
{% endcontent-ref %}

{% content-ref url="/pages/-LtclT1BHXAGPOJiWwm5" %}
[\*Migration from SDK v1.6.x to SDK v2.0.x](/sdk-installation/android-sdk-installation/migration-from-sdk-v1.6.x-to-sdk-v2.0.x)
{% endcontent-ref %}


# \*Getting started

{% content-ref url="/pages/-Ltcm4t4mTIMV12LcLYR" %}
[\*Set up Your Development Environment](/sdk-installation/android-sdk-installation/setup-and-enabling-sdk/set-up-your-development-environment)
{% endcontent-ref %}

{% content-ref url="/pages/-MUn9NEdmDDPD8yixOZ\_" %}
[\*Setup and enable SDK](/sdk-installation/android-sdk-installation/setup-and-enabling-sdk/setup-and-enable-sdk)
{% endcontent-ref %}

{% content-ref url="/pages/-MNO8YLFE\_M2sCiQ2EpE" %}
[\*Permissions wizard](/sdk-installation/android-sdk-installation/setup-and-enabling-sdk/permissions-wizard)
{% endcontent-ref %}

{% content-ref url="/pages/-MUme1jTaLBe0hL26BkD" %}
[\*Permissions dialog](/sdk-installation/android-sdk-installation/setup-and-enabling-sdk/permissions-dialog)
{% endcontent-ref %}

{% content-ref url="/pages/-LtcljhegfP2GhLdXYxh" %}
[\*Configure SDK variables for notifications](/sdk-installation/android-sdk-installation/setup-and-enabling-sdk/configure-sdk-variables-for-notifications)
{% endcontent-ref %}


# \*Set up Your Development Environment

To always link to the most recent version, link to the Raxel Pulse Android SDK with [Maven](https://maven.apache.org/) rather than downloading the SDK itself.

**Since SDK v.2.0.48 you need to migrate your App dependencies to use** **AndroidX**

Your module build.gradle file for SDK **>=** v. **2.0.58**

```scala
maven {
    url "https://s3.us-east-2.amazonaws.com/android.telematics.sdk.production/"
}
```

```scala
implementation "com.telematicssdk:tracking:x.x.x"

```

�Your module build.gradle file for SDK < v. **2.0.58**

```scala
repositories {
    ...
    maven {
        url "s3://s3.raxeltelematics.com"
        credentials(AwsCredentials) {
            accessKey "AKIAIJC3ZQKYCFAC2BPA"
            secretKey "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"
        }
    }
}
```

```scala
dependencies {
  ...
  implementation 'com.raxel.tracking:sdk:x.x.x'
}
```

**Latest release you can check on** [**Changelog page**](/sdk-installation/changelog/android-changelog)

**Proguard:**

```
-keep public class com.raxeltelematics.** {*;}
```

**For the new versions of the SDK you can face an issue like this:**&#x20;

`Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration.`\
&#x20;`- classes.jar (com.telematicssdk:tracking:x.x.xxx)`\
\
`Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior.  Note that this option is deprecated and will be removed in the future`

To resolve this issue just update your `gradle` version or specify this parameter in the `build.gradle` file of the app:

```scala
android {
  .....
   defaultConfig {
    .....
    javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
   }
  .....
  }

```

**Supported Android versions**

Minimum supported Android SDK version is **18**. Target version is **30**

```scala
...
defaultConfig {
        minSdkVersion 18
        targetSdkVersion 30
        ...
}
...
```


# \*Setup and enable SDK

## Overview

SDK setup is separated to 3 parts:

1. Initialization
2. Grating all required permissions
3. Enabling sdk

## Initialize SDK

#### Create Settings object

For **SDK version  2.2.217 and newer:**

```kotlin
/**
* Default Setting constructor
* Stop tracking time is 5 minute.
* Parking radius is 100 meters.
* Auto start tracking is true.
* hfOn - true if HIGH FREQUENCY data recording from sensors (acc, gyro) is ON and false otherwise.
* isElmOn - true if data recording from ELM327 devices is ON and false otherwise.
*/
val settings = Settings(Settings.stopTrackingTimeHigh, Settings.accuracyHigh, true, true, true)
```

For **SDK version < 2.2.217:**

```kotlin
/**
* Default Setting constructor
* IsSensorFull - true
* Stop tracking time is 5 minute.
* Parking radius is 100 meters.
* Auto start tracking is true.
*/
val settings = Settings(true, Settings.stopTrackingTimeHigh, Settings.accuracyHigh, true)
```

#### initialize SDK.

```kotlin
// call this in your Application class
val api = TrackingApi.getInstance()
api.initialize(this, settings)
```

## Grant RUNTIME permissions.

In your application you need to request runtime permissions (see list below) for the SDK to work correctly. So request them prior to enable SDK and start tracking.&#x20;

```markup
android.Manifest.permission.ACCESS_FINE_LOCATION,
android.Manifest.permission.ACCESS_COARSE_LOCATION,
android.Manifest.permission.ACCESS_BACKGROUND_LOCATION (for Android >=10 (Q))
android.Manifest.permission.ACTIVITY_RECOGNITION (for Android >=10 (Q))
android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
```

Or you can just use our [Permission wizard](/sdk-installation/android-sdk-installation/setup-and-enabling-sdk/permissions-wizard) or [Permissions dialog](/sdk-installation/android-sdk-installation/setup-and-enabling-sdk/permissions-dialog). Both of them contais all needed logic for asking required permissions and they are fully compatible with [new Google politics](https://support.google.com/googleplay/android-developer/answer/9799150?hl=en).

## Enable/disable SDK.

Befor enabling the SDK you should check are all required permissions granted. And only after that you can enable the SDK.

Following code sample shows how to do it:

```kotlin
val trackingApi = TrackingApi.getInstance()
if (trackingApi.isAllRequiredPermissionsAndSensorsGranted()) {
   trackingApi.setDeviceID("YOUR DEVICE ID") // DEV_ID from Raxel
   trackingApi.setEnableSdk(true) 
} 
```

If you want to **disable** sdk:

```kotlin
trackingApi.setEnableSdk(false)

```

The following code sample shows how to **logout** from sdk:

```kotlin
trackingApi.setEnableSdk(false)
trackingApi.clearDeviceID()
```

Firstly, you should disable sdk and after that clear the device id.

## Disable SDK after tracks uploading <a href="#title-text" id="title-text"></a>

There is a case when user wants to disable the sdk after trip was ended. Common case looks like this:

1. Subscibe to [tracking events](/sdk-installation/android-sdk-installation/subscribe-to-tracking-events) and listen to `onStopTracking` method
2. Disable sdk by `TrackingApi.getInstance().setEnableSdk(false)`

But there is on important moment: sdk can be disabled and recorded track may not be uploaded. Because track uploading may take some time. For that purpose you can use `TrackingApi.getInstance().setDisableWithUpload()` method. It will wait until all tracks will be uploaded and only after that SDK will be disabled.

When SDK is waiting to tracks uploading notification text will be changed to `Waiting for the tracks uploading`

Also you can override this resource on your side: `<string name="tracking_notification_looking_for_tracks_upload" >Waiting for the tracks uploading</string>`


# \*Permissions wizard

Since 2.2.225 version we don't need access to phone's local storage and implemented more comfortable way to customize our Permissions wizard.

## Overview

**Wizard** is user-friendly activity with step-by-step description of each required permissions and Proceed button to request them. For example, wizard will look like this on Android 10:

![](https://lh3.googleusercontent.com/G8F0wq-UUcij_KVIDjkbFdpzoIH2UN18WGA37UGcq0563zmTWzG9Nt8zXYOMj6sfT0zbZKt1S5JnlsCYhu9M1wzhDzpTSmOWAqy2Xw2OUFgYx6BXkp_GQlXX6_Imkw)![](https://lh3.googleusercontent.com/PfIuvSsXlVDLONlEqHKD-lTvOlGiHtNLEu9QO1GRGnZvpF9cA4eHY3rtVa7RSEawf4ZjEHK8W98znWMpr1EHtAiHarFYugRkWeynSs6wQT7P9w49wdreDkbNjhONDg)

![](https://lh5.googleusercontent.com/5wD2NEXg9vdmb9NNpQULYEaGv3V29I6yZ7Y-LeyylhV3l97gXYpkPO0Dx1Xid57_nTaNQBe-8QK2j-FLV8BQrk92svKHdgreoBRED97VyHYdTo23YBPjjlh6nWn4ww)

To start wizard from your activity or fragment use code below:

```kotlin
startActivityForResult(
       PermissionsWizardActivity
               .getStartWizardIntent(
                       context = this,
                       enableAggressivePermissionsWizard  = false,
                       enableAggressivePermissionsWizardPage  = false
               ),
       PermissionsWizardActivity.WIZARD_PERMISSIONS_CODE
)
```

Where **enableAggressivePermissionsWizard** flag you set to **true** when wizard will be finished if all required permissions granted (user can’t cancel it with back button), and **false** if wizard can be finished with not all granted permissions or cancelled with back button.<br>

Where **enableAggressivePermissionsWizardPage** flag you set to **true** when wizard will slide to next page if requested permissions granted on current page, and **false** if wizard can slide with not granted permissions.

See table below to see how it works:

| enabled Aggressive Permissions Wizard | enabled Aggressive Permissions WizardPage | <p>cancelable wizard<br></p> | can deny requested pemission and slide to next step | can finish wizard without all granted perms |
| ------------------------------------- | ----------------------------------------- | ---------------------------- | --------------------------------------------------- | ------------------------------------------- |
| true                                  | true                                      | no                           | no                                                  | no                                          |
| true                                  | false                                     | no                           | yes                                                 | no                                          |
| false                                 | true                                      | yes                          | no                                                  | no                                          |
| false                                 | false                                     | yes                          | yes                                                 | yes                                         |

And after that you can get the result in `onActvityResult` method by this way:

```kotlin
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
   super.onActivityResult(requestCode, resultCode, data) 
   // don’t forget to call here and in all base activity/fragments
   if (requestCode == PermissionsWizardActivity.WIZARD_PERMISSIONS_CODE) {
       when (resultCode) {
           WIZARD_RESULT_ALL_GRANTED -> {
               /* when user finished wizard with all required permissions
granted - enable SDK if Device ID is exist*/
               enableSDK()
           }
           WIZARD_RESULT_CANCELED -> {
               // when user canceled wizard
               Toast.makeText(this, "Wizard canceled!",
Toast.LENGTH_SHORT).show()
           }
           WIZARD_RESULT_NOT_ALL_GRANTED -> {
               /* when user finished wizard with not all required permissions
granted*/
               Toast.makeText(this, "NOT All Required Permissions Granted!",
Toast.LENGTH_SHORT).show()
           }
       }
   }
}
```

## Customizing

The permission wizard can be different. But generally there could be **8 screens:**

### Location permission screen

Location restrictions on Android were chaged twice in 10 and 11 versions.&#x20;

If you want to customize description of this screen you should override resources:

**values/strings.xml**

```markup
    <!-- Generic location permission description -->
    <string name="wizard_telematics_location_desc">As the next step, you will receive a popup to grant rights to access to <b>location</b>.\n\n
        We use location service for evaluating your driving manner.\nBy enabling <b>Allow</b> on location, application will be able to automatically determine when you have started and ended a drive.
    </string>

    <!-- Bottom dialog before the app name text-->
    <string name="wizard_telematics_attention_dialog_location_before">Allow</string>
    
    <!-- Bottom dialog after the app name text -->
    <string name="wizard_telematics_attention_dialog_location_after">to\naccess this device\'s location?</string>
```

**values-v29/strings.xml**

```markup
<!-- Android 10 location permission description -->
<string name="wizard_telematics_location_desc">As the next step, you will receive a popup to grant rights to access to <b>location</b>.\n\n
    We use location service for evaluating your driving manner.\nBy enabling <b>Allow all the time</b> on location, application will be able to automatically determine when you have started and ended a drive.
</string>
<!-- Bottom dialog after the app name text-->
<string name="wizard_telematics_attention_dialog_location_after">to access this device\'s location?</string>
```

**values-v30/strings.xml**

```markup
<!-- Android 11 location permission description -->
<string name="wizard_telematics_location_desc">As the next step, you’ll see a popup to grant app access to <b>location services</b>.\n\n
        The app uses your location data to automatically record your trips in background, determine when you have started and ended your trip and to measure your score.\n\n
        The app will not work without this permission.\n\n
        On the next popup, please select <b>While using the app</b>.
</string>

```

### Background location permission screen

Since Android 11 Google introduced new privacy feature releated to location permission granting. Now if application needs access to users location in the background it should first grant access to **foreground location** and only after that it can ask permission to access **locaition in the background**.

&#x20;**values/strings.xml**

```markup
<!-- background location permission description -->
<string name="wizard_telematics_background_location_desc">
        As the next step, you should grant rights to access to <b>location in background.</b>\n\n
        The app will not work without this permission.\n\n
        You should navigate to app settings and choose "<b>Allow all the time</b> on the Location permission screen.</string>
    
<!-- Additional text in the bottom dialog -->
<string name="wizard_telematics_location_additional_description">This app may want to access your location all the time, even when you\'re not using the app. <font color="#a7c7f9"><u>Allow in settings.</u></font></string>

<!-- Dialog text before app name -->        
<string name="wizard_telematics_attention_dialog_background_location_before">Change location access for </string>

<!-- Dialog text after app name -->      
<string name="wizard_telematics_attention_dialog_background_location_after">\?</string>

<!-- Dialog text to keep permission in "While using the app" -->  
<string name="wizard_telematics_location_additional_keep">Keep \'While using the app\'</string>  
```

### Activity recognition permission screen (since Android 10)

**values/strings.xml**

```markup
<!-- Wizard activity recognition section -->
<string name="wizard_telematics_activity_recognition_desc">Then, you will receive a popup to grant access to your <b>physical activity</b>. \nWe need this information to create a driving score.\n\n
    Please, choose <b>Allow</b> for application to grant access to physical activity.
</string>
<!-- Bottom dialog before the app name text-->
<string name="wizard_telematics_attention_dialog_activity_recognition_before">Allow</string>
<!-- Bottom dialog after the app name text-->
<string name="wizard_telematics_attention_dialog_activity_recognition_after">to\naccess your physical activity?</string>
```

**values-v29/strings.xml**

```markup
<!-- Bottom dialog after the app name text-->
<string name="wizard_telematics_attention_dialog_activity_recognition_after">to access your physical activity?</string>
```

### Device location permission screen (when location services are switched off on the device)

**values/strings.xml**

```markup
<!-- Gps services description -->
<string name="wizard_telematics_gps_google_desc">You will receive a popup shortly to turn on <b>device location</b>, which uses Google\'s location service.\n\n
    For the app to work properly choose <b>OK</b>
</string>
<string name="wizard_telematics_attention_dialog_gps_google">For a better experience, turn on device location, which uses Google\'s location service.</string>
<string name="dialog_telematics_attention_dialog_gps_google_ok">OK</string>
<string name="dialog_telematics_attention_dialog_gps_google_no">No, thanks</string>
```

### Battery optimization permission screen

**values/strings.xml**

```markup
<string name="wizard_telematics_ignore_system_battery_optimization_desc">You will receive a popup shortly to ignore <b>battery optimizations</b>.\n\n
    For the app to work properly choose <b>ALLOW</b>
</string>
<string name="wizard_telematics_attention_dialog_battery">Let app always run in background?\n\nAllowing application to always run in the\nbackground may reduce battery life.\n\nYou can change this later from\nSettings > Apps &amp; notifications.</string>
<string name="dialog_telematics_attention_dialog_battery_ok">ALLOW</string>
<string name="dialog_telematics_attention_dialog_battery_no">DENY</string>
```

### Custom power management tools disabling screen (custom feature for smartphones manufacturers like Samsung, Xiaomi, Huawei etc.)

**values/strings.xml**

```markup
<string name="wizard_telematics_extra_power_management_desc">By press "Proceed" you will be forwarded to settings to setup <b>power management</b>.\n
For the app to work properly <b>DISABLE</b> power management.
</string>
```

### Autostart enabling screen (custom feature for smartphones manufacturers like Xiaomi, Huawei etc.)

**values/strings.xml**

```markup
<string name="wizard_telematics_extra_autostart_desc">By press "Proceed" you will be forwarded to settings to setup <b>AUTOSTART</b>.\n
    For the app to work properly <b>ENABLE</b> autostart</string>
```

### Notifications showing permissions screen (custom feature for smartphones manufacturers)

**values/strings.xml**

```markup
<string name="wizard_telematics_extra_notifications_desc">By press "Proceed" you will be forwarded to settings to setup <b>notifications</b>.\n
For the app to work properly <b>ENABLE</b> all notification.</string>
```

### Additional resources

**values/strings.xml**

```markup
<!-- Bottom proceed button resource -->
<string name="wizard_telematics_show_request">Proceed</string>
<!-- Allow button resource -->
<string name="wizard_telematics_deny">Deny</string>
<!-- Deny button resource -->
<string name="wizard_telematics_allow">Allow</string>
<!-- Allow all the time resource -->
<string name="wizard_telematics_allow_all_time">Allow all the time</string>
<!-- Allow only while using the app resource -->
<string name="wizard_telematics_allow_while_using">Allow only while using the app</string>
<!-- Steps resource in the top of wizard. !Important! FORMAT SHOULD BE THE SAME! -->
<string name="wizard_telematics_step">STEP %1s of %2s</string>

<string name="wizard_telematics_please_grant">Please, grant all required permissions</string>

<!-- Android 11 new resoucres-->
<string name="wizard_telematics_while_using_11">While using the app</string>
<string name="wizard_telematics_only_this_time">Only this time</string>
<string name="wizard_telematics_ask_every_time">Ask every time</string>
```

### Common text customizations

All resources which are used are supporting [Html-markup styling](https://developer.android.com/guide/topics/resources/string-resource#StylingWithHTML). But also you can set custom font and font the text (or to the part of the text) via [annotations](https://developer.android.com/guide/topics/resources/string-resource#StylingWithAnnotations)

#### **Customizing font:**

1. Specify your font in resources (check [documentation](https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml#using-support-lib))
2. Specify annotation for the text with name **font**

**Sample:**

Add custom support library font

![](/files/-MNOOuV5upZOtXf-4Lg3)

**digital\_font.xml**

```
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">
    <font app:font="@font/digital" />
</font-family>
```

Add the `<annotation>` tag, and define the key-value pair. In this case, the key is **font**, and the value is the font-resource name

```
<string name="wizard_telematics_gps_google_desc">You will receive a popup shortly to turn on <b>device location</b>, which uses <annotation font="digital">Google\'s</annotation> location service.\n\n
    For the app to work properly choose <b>OK</b>
</string>
```

#### Customizing size of the text

1. Add dimen resource of the
2. Specify annotation for the text with name **textSize**

**Sample**

Dimen-resource:

```
<dimen name="text_size">12sp</dimen>
```

Add the `<annotation>` tag, and define the key-value pair. In this case, the key is **textSize**, and the value is the dimen-resource name

```
<string name="wizard_telematics_gps_google_desc">You will receive a popup shortly to turn on <b>device location</b>, which uses <annotation font="digital" textSize="text_size">Google\'s</annotation> location service.\n\n
    For the app to work properly choose <b>OK</b>
</string>
```

### Customizing image-resources

If you dont want to use our bottom dialog view you can replace it with your own drawable-resource:

Specify drawable resource with the name:

```
// location permission screen image
ic_wizard_image_location

// background location permission screen image
ic_wizard_image_location_background

// activity recognition permission screen image
ic_wizard_image_activity_recognition

// device location screen image
ic_wizard_image_gps_sensor

// battery optimization permission screen image
ic_wizard_image_battery_optimization

// huawei autostart permission screen image
ic_wizard_autostart_huawei

// xiaomi autostart permission screen image
ic_wizard_autostart_xiaomi

// default autostart permission screen image
ic_wizard_autostart_default

// notifications showing permission screen image
ic_wizard_notifications_default
```

### Customizing colors

\
**values\colors.xml**

```markup
<!-- Wizard -->
<color name="colorTelematicsWizardBackground">#FAFAFA</color>
<color name="colorTelematicsWizardPrimaryText">#494949</color>
<color name="colorTelematicsWizardSecondaryText">#80464646</color>
<color name="colorTelematicsWizardButtonText">#fff</color>
<color name="colorTelematicsWizardButtonNorm">#80464646</color>
<color name="colorTelematicsWizardButtonPressed">#464646</color>
```

```markup
<!-- Alert dialog inside wizard - common colors -->
<color name="colorTelematicsDialogAlertBackground">#fff</color>
<color name="colorTelematicsDialogAlertButtonActiveBg">#ff8400</color>
<color name="colorTelematicsDialogAlertText">#80464646</color>
<color name="colorTelematicsDialogAlertButtonActiveText">#fff</color>
```

```markup
<!-- Alert dialog inside wizard for Android =< 9 -->
<color name="colorTelematicsDialogAlertInactiveText">#009687</color>
```

```markup
<!-- Alert dialog inside wizard for Android >= 10 -->
<color name="colorTelematicsDialogAlertInactiveTextQ">#a7c7f9</color>
```

### **Customizing dimens**

**values\dimens.xml**\
**values-xhdpi\dimens.xml**\
**values-xxhdpi\dimens.xml**&#x20;

```markup
<!-- Overrided DialogFragment SDK resources -->
<dimen name="dialog_telematics_view_bubble_corners">20dp</dimen>
<dimen name="dialog_telematics_button_corners">35dp</dimen>
```

```markup
<!-- Overrided Wizard SDK resources -->
<dimen name="wizard_telematics_button_corners">5dp</dimen>
```


# \*Permissions dialog

## Overview

Permissions **Dialog** is DialogFragment (non-fullscreen popup window) with buttons for request permissions and show granted status for them.

![](https://lh6.googleusercontent.com/9MkFVHN3HWwJPrPeGosJuQ9XFbVKmgiQYGdtR_LfxhHm36nzlY0Y8EAqBxvfd6yw_WWtlzQ7WRDyUA-lsO0zQrde8YSjThfZTGcVWelRp8zz3JvA50Dac1nJa6IFMw)

To start dialog from your activity or fragment use the code below:

```kotlin
private var permsFragment: PermissionsDialogFragment? = null
override fun onCreate(savedInstanceState: Bundle?) {
   super.onCreate(savedInstanceState)
   permsFragment = PermissionsDialogFragment.newInstants(dismissIfAllGranted =
false)
   permsFragment?.setPermissionsGrantedListener(object :
PermissionsDialogFragment.PermissionsGrantedListener {
       override fun onGrantedStatus(allPermsGranted: Boolean) {
           if (allPermsGranted) enableSDK() // enabled SDK if not enabled
       }
   })
}
private fun showPermissionsDialog() {
   permsFragment?.let {
       if (!permsFragment!!.isVisible) permsFragment?.show(supportFragmentManager, PermissionsDialogFragment.PERMISSION_FRAGMENT_TAG)
   }
}

```

Where **dismissIfAllGranted** flag you set to **true** and dialog will be dismissed (closed) automatically when all permissions are granted. If flag is **false** dialog will not be disappeared when all permissions granted, user can do it by himself.

## Customizing

### Colors

**values\colors.xml**

```markup
<!-- Permission Dialog Fragment -->
<color name="colorTelematicsDialogBackground">#fff</color>
<color name="colorTelematicsDialogPrimaryText">#494949</color>
<color name="colorTelematicsDialogSecondaryText">#80464646</color>
<color name="colorTelematicsDialogButtonText">#494949</color>
<color name="colorTelematicsDialogButtonNorm">#fff</color>
<color name="colorTelematicsDialogButtonPressed">#80464646</color>
```

### **Dimens**

**values\dimens.xml**\
**values-xhdpi\dimens.xml**\
**values-xxhdpi\dimens.xml**&#x20;

```markup
<!-- Overrided DialogFragment SDK resources -->
<dimen name="dialog_telematics_view_bubble_corners">20dp</dimen>
<dimen name="dialog_telematics_button_corners">35dp</dimen>
```

```markup
<!-- Overrided Wizard SDK resources -->
<dimen name="wizard_telematics_button_corners">5dp</dimen>
```

### Drawables

**values/drawable-xxxhdpi**

Granted permission image:

![ic\_telematics\_ok.png (60x60)](/files/-MUmgpMNNtRiJHBdPSAH)

Location permission image:

![ic\_telematics\_map\_geo.png (72x72)](/files/-MUmh0dJ9JuR0AX_AM10)

Physical activity permission image:

![ic\_telematics\_motion.png (72x72)](/files/-MUmhEliQaH9PlGkM4FT)

Background optimization permission screen:

![ic\_telematics\_background\_tracking.png (72x72)](/files/-MUmhzuakDUssB2EvIaF)


# \*Configure SDK variables for notifications

Raxel Pulse SDK sends notifications to user like below: (ex. from Android 10)\ <br>

![](https://lh6.googleusercontent.com/huOitmS5JJofK8VJ3eX-pBDMXnOVcOpBjSRyI9c2Hdki8hkzFYd0ZEJRElUnqmf1kp9USJlDSLyfz1OJJYMU31N9Uu5e4QLldRcEwIWqaMUx4k4E1CccoCKYuM_mtA)

You can override strings that used for user notifications:

```markup
<string name="app_name">Raxel-NewSDK</string>
<string name="tracking_notification_title">Tracking</string>
<string name="tracking_notification_is_work">Your trip is being scored.</string>
<string name="tracking_notification_is_not_work">Trip not in progress.</string>
<string name="tracking_notification_tracking_disabled">Tracking disabled.</string>
<string name="tracking_notification_gps_disabled">GPS disabled. Click the notification to enable GPS and grant permissions.</string>
<string name="tracking_notification_power_saving_enabled">Your trips may not be recorded when battery saving mode is enabled</string>
<string name="tracking_notification_looking_for_tracks_upload" >Waiting for the tracks uploading</string>
```

You can override icons that used for user notification:

Place your own icons to res/drawable folders with names below:<br>

ic\_tracking\_sdk\_status\_bar.png - use **white-colored** square image with alpha-channel\
ic\_tracking\_sdk\_notification.png - use **colored** square image with alpha-channel\ <br>

![](https://lh6.googleusercontent.com/2NEK0BViOgESe40crBjPlaEd9yGqi4mXOvmJVR6XXEBThIhupFPuQAzg3nlok2yceN2AtBP7Y362zSVQpK3wq5d7dJZTS-e7HHG5JiiQRBg1b9iSyZi_je24dIJqCA)


# \*Subscribe to tracking events

## Tracking events broadcast receiver

You can implement an instance of `TrackingEventsReceiver` and subscribe to tracking events.

Add following class to your application:

```kotlin
class TrackingReceiver : TrackingEventsReceiver() {
	override fun onLocationChanged(context: Context, location: Location) {
		// Location updates
	}
	override fun onStartTracking(context: Context) {
        // tracking was started
	}
	override fun onStopTracking(context: Context) {
		// tracking was stopped
	}
	override fun onSpeedViolation(context: Context, violation: SpeedViolation) {
		// Receive speed violation
	}

	override fun onNewEvents(context: Context, events: Array<Event>) {
		// receive an updates about new events
	}

	override fun onSdkDeprecated(context: Context) {
		// receive callback about deprecated events
	}
}
```

Add this broadcast receiver to the manifest before the `</application>` tag.

```markup
<receiver android:name=".TrackingReceiver"/>
```

Register it:

```kotlin
TrackingApi.getInstance().registerTrackingEventsReceiver(TrackingReceiver::class.java)
```

Don't forget to unregister when it’s not needed:

```kotlin
TrackingApi.getInstance().unregisterTrackingEventsReceiver()
```

## Listeners

### Start and stop tracking callback

```kotlin
// initialize callback
val callback = object : TrackingStateListener {
		override fun onStopTracking() {
			// tracking stopped
		}		override fun onStartTracking() {
			// tracking started
		}
	}
// register it in SDK
TrackingApi.getInstance().registerCallback(callback)
```

### Callback to be invoked when new location was found

{% hint style="info" %}
This feature is available from **2.2.228** version. Latest release you can check on [**Changelog page**](/sdk-installation/changelog/android-changelog)
{% endhint %}

```kotlin
// initialize callback
val callback = object : com.raxeltelematics.v2.sdk.LocationListener {
			override fun onLocationChanged(location: Location?) {
				// your logic here
			}
		}
// register it in SDK
TrackingApi.getInstance().setLocationListener(callback)

// Don't forget to remove callback by passing null to this method when it is not needed
TrackingApi.getInstance().setLocationListener(null)
```

### Speed violation callback

```kotlin
val callback = object : com.raxeltelematics.v2.sdk.SpeedViolationsListener {
			override fun onSpeedViolation(violation: SpeedViolation) {
						// your logic here
			}
		}
// register it in SDK
TrackingApi.getInstance().registerSpeedViolations(speedLimit, speedTimeout, callback)

// Don't forget to remove callback by passing null to this method when it is not needed
TrackingApi.getInstance().unregisterSpeedViolationCallback()
```


# \*Incoming tags managing

Available since v2.2.243

In **2.2.243** version of the SDK incoming tags processing was added. It supports both online and offline modes. All tags will be uploaded with the specified time when they were made.

Methods doesn’t return any data. You can register a `TagsProcessingListener` or `TagsProcessingReceiver` (it is a BroadcastReceiver you have to implement on your side and register with the SDK) for subscribing to tags processing updates.

Methods for managing:

```kotlin
    /**
	 * Get tags
	 *
	 * The result of the operation you can get through the registration of [TagsProcessingListener] or [TagsProcessingReceiver].
	 * Check [registerTagsReceiver] and [addTagsProcessingCallback]
	 *
	 * @throws IllegalStateException if [initialize] never called. See also [isInitialized].
	 */
	fun getFutureTrackTags()

    /**
	 * Create new tag
	 *
	 * The result of the operation you can get through the registration of [TagsProcessingListener] or [TagsProcessingReceiver].
	 * Check [registerTagsReceiver] and [addTagsProcessingCallback]
	 * @param tag tag's name
	 * @param source source of the tag. Optional parameter
	 *
	 * @throws IllegalStateException if [initialize] never called. See also [isInitialized].
	 */
	fun addFutureTrackTag(tag: String?, source: String? = null)

    /**
	 * Remove specified tag
	 *
	 * The result of the operation you can get through the registration of [TagsProcessingListener] or [TagsProcessingReceiver].
	 * Check [registerTagsReceiver] and [addTagsProcessingCallback]
	 * @param tag tag's name
	 *
	 * @throws IllegalStateException if [initialize] never called. See also [isInitialized].
	 */
	fun removeFutureTrackTag(tag: String?)
	
	/**
	 * Remove all tags.
	 *
	 * The result of the operation you can get through the registration of [TagsProcessingListener] or [TagsProcessingReceiver].
	 * Check [registerTagsReceiver] and [addTagsProcessingCallback]
	 *
	 * @throws IllegalStateException if [initialize] was never called. See also [isInitialized].
	 */
	fun removeAllFutureTrackTags()
```

## TagsProcessingListener

It has inside 4 methods:

1. `onTagAdd(tag: Tag, activationTime: Long, status: Status)` - callback of the `addFutureTrackTag` method\
   Parameters:\
   1\. `tag` - Tag instance for adding\
   2\. `activationTime` - UNIX-timestamp in milliseconds of the tag activation time\
   3\. `status` - Status of the operation. Status can be:\
   `Status.SUCCESS` when tag was successfully uploaded to server\
   `Status.OFFLINE` when tag wasn’t uploaded to server (no internet, etc.), but will be sent later (when internet connection will appears)\
   `Status.ERROR_TAG_OPERATION` when operation can’t be proceeded on server because tag was already created earlier\
   `Status.ERROR_WRONG_TIME` when user sent wrong tme (future)\
   `Status.ERROR_INVALID_TAG_SPECIFIED` when tag name is null or empty<br>
2. `onTagRemove(tag: Tag, deactivationTime: Long, status: Status)` - callback of the `removeFutureTrackTag` method\
   Parameters:\
   1\. `tag` - Tag instance for removing\
   2\. `deactivationTime` - UNIX-timestamp in milliseconds of the tag deactivation time\
   3\. `status` - Status of the operation. Status can be:\
   `Status.SUCCESS` when tag was successfully removed from server\
   `Status.OFFLINE` when operation wasn’t pushed to server (no internet, etc.), but will be sent later (when internet connection will appears)\
   `Status.ERROR_TAG_OPERATION` when operation can’t be proceeded on server because tag wasn’t exist\
   `Status.ERROR_WRONG_TIME` when user sent wrong tme (future)\
   `Status.ERROR_INVALID_TAG_SPECIFIED` when tag name is null or empty<br>
3. `onAllTagsRemove(deactivatedTagsCount: Int, time: Long, status: Status)`- callback of the `removeAllFutureTrackTags` method\
   Parameters:\
   1\. `deactivatedTagsCount` - deactivated tags amount\
   2\. `time` - UNIX-timestamp in milliseconds (time of the operation)\
   3\. `status` - Status of the operation. Status can be:\
   `Status.SUCCESS` "Remove all tags" request was successfully proceeded\
   `Status.OFFLINE` when operation wasn’t pushed to server (no internet, etc.), but will be sent later (when internet connection will appears)\
   `Status.ERROR_TAG_OPERATION` when operation can’t be proceeded on server\
   `Status.ERROR_WRONG_TIME` when user sent wrong tme (future)<br>
4. `onGetTags(tags: Array<Tag>?, time: Long, status: Status)`- callback of the `getFutureTrackTags` method\
   Parameters:\
   1\. `tags` - `Array<Tag>?` - array of tags. Can be null if status in not `SUCCESS`\
   2\. `time` - UNIX-timestamp in milliseconds (time of the operation)\
   3.`status` - Status of the operation. Status can be:\
   `Status.SUCCESS` - success\
   `Status.OFFLINE` if there is no internet connection

**Sample of using** TagsProcessingListener

1. Implement it on your side

```kotlin
val listener = object : TagsProcessingListener {
	override fun onTagAdd(status: Status, tag: Tag, activationTime: Long) {
		runOnUiThread {
			when (status) {
				Status.SUCCESS -> {
					// tag successfully added
				}
				Status.OFFLINE -> {
					// tag was saved to the local storage. It will be sent later when internet will be available
				}
				Status.ERROR_TAG_OPERATION -> {
					// unable to add tag to server (The tag has already been created)
				}
				Status.ERROR_WRONG_TIME -> {
					// Unable to perform operation. Future time specified.
				}
				Status.ERROR_INVALID_TAG_SPECIFIED -> {
					// null or blank tag name specified
				}
			}
		}
	}

	override fun onTagRemove(status: Status, tag: Tag, deactivationTime: Long) {
		runOnUiThread {
			when (status) {
				Status.SUCCESS -> {
					// tag was successfully removed
				}
				Status.OFFLINE -> {
					// tag deactivation was saved to the local storage. It will be sent later when internet will be available
				}
				Status.ERROR_TAG_OPERATION -> {
					// unable to add tag to server (Tag doesn't exist. Unable to remove)
				}
				Status.ERROR_WRONG_TIME -> {
					// Unable to perform operation. Future time specified.
				}
				Status.ERROR_INVALID_TAG_SPECIFIED -> {
					// null or blank tag name specified
				}
			}
		}
	}

	override fun onAllTagsRemove(status: Status, deactivatedTagsCount: Int, time: Long) {
		runOnUiThread {
			when (status) {
				Status.SUCCESS -> {
					// "Remove all tags" request was successfully proceeded
				}
				Status.OFFLINE -> {
					// "Remove all tags" request was saved to the local storage. It will be sent later when internet will be available
				}
				Status.ERROR_TAG_OPERATION -> {
					// unable to proceed on server
				}
				Status.ERROR_WRONG_TIME -> {
					// Unable to perform operation. Future time specified.
				}
			}
		}
	}

	override fun onGetTags(status: Status, tags: Array<Tag>?, time: Long) {
		runOnUiThread {
			when (status) {
				Status.SUCCESS -> {
					// all cached requests (for add/ remove/ remove all tags) were proceeded and tags fetched successfully
				}
				Status.OFFLINE {
					// can't fetch tags list. Try again later
				}
			}
		}
	}
}
```

2\. Add it to the SDK:

```kotlin
TrackingApi.getInstance().addTagsProcessingCallback(listener)
```

3\. Don’t forget to remove listener when it’s not needed:

```kotlin
TrackingApi.getInstance().removeTagsProcessingCallback()
```

## Tags processing receiver

`TagsProcessingReceiver` works the same as `TagsProcessingListener` . But it's a `BroadcastReceiver`.

Methods are the same at all.

**Sample of using** `TagsProcessingReceiver`&#x20;

1. Add the following class to your application

```kotlin
class TagsReceiver : TagsProcessingReceiver() {
	override fun onTagAdd(status: Status, tag: Tag, activationTime: Long) {
		when (status) {
			Status.SUCCESS -> {
				// tag successfully added
			}
			Status.OFFLINE -> {
				// tag was saved to the local storage. It will be sent later when internet will be available
			}
			Status.ERROR_TAG_OPERATION -> {
				// unable to add tag to server (The tag has already been created)
			}
			Status.ERROR_WRONG_TIME -> {
        // Unable to perform operation. Future time specified.
      }
      Status.ERROR_INVALID_TAG_SPECIFIED -> {
					// null or blank tag name specified
			}
		}
	}

	override fun onTagRemove(status: Status, tag: Tag, deactivationTime: Long) {
		when (status) {
			Status.SUCCESS -> {
				// tag was successfully removed
			}
			Status.OFFLINE -> {
				// tag deactivation was saved to the local storage. It will be sent later when internet will be available
			}
			Status.ERROR_TAG_OPERATION -> {
				// unable to add tag to server (Tag doesn't exist. Unable to remove)
			}
			Status.ERROR_WRONG_TIME -> {
        // Unable to perform operation. Future time specified.
      }
      Status.ERROR_INVALID_TAG_SPECIFIED -> {
					// null or blank tag name specified
			}
		}
	}

	override fun onAllTagsRemove(status: Status, deactivatedTagsCount: Int, time: Long) {
		when (status) {
			Status.SUCCESS -> {
				// "Remove all tags" request was successfully proceeded
			}
			Status.OFFLINE -> {
				// "Remove all tags" request was saved to the local storage. It will be sent later when internet will be available
			}
			Status.ERROR_TAG_OPERATION -> {
				// unable to proceed on server
			}
			Status.ERROR_WRONG_TIME -> {
        // Unable to perform operation. Future time specified.
      }
		}
	}

	override fun onGetTags(status: Status, tags: Array<Tag>?, time: Long) {
		when(status) {
			Status.SUCCESS -> {
				// all cached requests (for add/ remove/ remove all tags) were proceeded and tags fetched successfully
			}
			Status.OFFLINE -> {
				// can't fetch tags list. Try again later
			}
		}
	}
}
```

2\. Add this broadcast receiver to the manifest before the `</application>` tag.

```markup
<receiver android:name=".TagsReceiver"/>
```

3\. Register it with SDK:

```kotlin
TrackingApi.getInstance().registerTagsReceiver(TagsReceiver::class.java)
```

4\. Don't forget to unregister when it’s not needed:

```kotlin
TrackingApi.getInstance().unregisterTagsReceiver()
```


# \*Migration from SDK v1.6.x to SDK v2.0.x

Now all SDK methods are collected in TrackingApi class - use TrackingApi.getInstance() to call them.

1. Change call Tracking to call TrackingApi.getInstance()
2. Migrate and import all new SDK classes listed at the table below:

from com.raxeltelematics.v2.sdk\
from com.raxeltelematics.v2.sdk.server.model\
from com.raxeltelematics.v2.sdk.server.model.sdk<br>

|                            |                           |
| -------------------------- | ------------------------- |
| Tracking                   | TrackingApi.getInstance() |
| Settings                   | Settings                  |
| TrackingStateListener      | TrackingStateListener     |
| Trip                       | Track                     |
| TripDetails                | TrackDetails              |
| TripOriginDictionary       | TrackOriginDictionary     |
| DashboardInfo              | DashboardInfo             |
| DrivingDetails             | DrivingDetails            |
| DrivingTimeDetail          | DrivingTimeDetails        |
| MileageDetail              | MileageDetails            |
| PhoneDetail                | PhoneDetails              |
| SpeedDetail                | SpeedDetails              |
| StatisticPeriod            | StatisticPeriod           |
| DiagramEntity              | DiagramEntity             |
| -                          | Locale - added            |
| TrackingUpdateDataReceiver | removed                   |

3\. Migrate to new methods and resources from table below:&#x20;

|                                                                                                                                                                                                                      |                                                                                                                                                                                           |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| initialize(context, Settings settings)                                                                                                                                                                               | initialize(context: Context, settings: Settings?)                                                                                                                                         |
| -                                                                                                                                                                                                                    | isInitialized(): Boolean                                                                                                                                                                  |
| -                                                                                                                                                                                                                    | isDeviceIdEmpty(): Boolean                                                                                                                                                                |
| -                                                                                                                                                                                                                    | getDeviceId(): String?                                                                                                                                                                    |
| -                                                                                                                                                                                                                    | isSdkEnabled(): Boolean                                                                                                                                                                   |
| isRunning()                                                                                                                                                                                                          | isTracking()                                                                                                                                                                              |
| setDeviceID(context, deviceID)                                                                                                                                                                                       | setDeviceID(deviceID)                                                                                                                                                                     |
| setEnableSdk(context, Boolean enable)                                                                                                                                                                                | setEnableSdk(enable: Boolean)                                                                                                                                                             |
| clearDeviceID(context)                                                                                                                                                                                               | clearDeviceID()                                                                                                                                                                           |
| startTracking(context)                                                                                                                                                                                               | startTracking()                                                                                                                                                                           |
| stopTracking(context)                                                                                                                                                                                                | stopTracking()                                                                                                                                                                            |
| <p>getTrips(context,</p><p>             locale: String,</p><p>             startDate: String? = null,</p><p>             endDate: String? = null,</p><p>             offset: Int,</p><p>             count: Int)</p> | <p>getTracks(locale: Locale,</p><p>             startDate: String? = null,</p><p>             endDate: String? = null,</p><p>             offset: Int,</p><p>             count: Int)</p> |
| getTripDetails(locale: String, trackId, context)                                                                                                                                                                     | getTrackDetails(trackId: String, locale: Locale)                                                                                                                                          |
| <p>getTripOriginDict(context, locale: String)<br></p>                                                                                                                                                                | getTrackOriginDict(dictionaryLocale: Locale)                                                                                                                                              |
| changeTripOrigin(String trackId, String value, context)                                                                                                                                                              | changeTrackOrigin(trackToken: String, newCode: String)                                                                                                                                    |
| getDashboardInfo(context)                                                                                                                                                                                            | getDashboardInfo()                                                                                                                                                                        |
| <p>getDrivingDetailsStatistics(context, StatisticPeriod period)</p><p>getDrivingTimeDetailsStatistics(context, StatisticPeriod period)</p>                                                                           | <p>getDrivingDetailsStatistics(period: StatisticPeriod)</p><p>getDrivingTimeDetailsStatistics(period: StatisticPeriod)</p>                                                                |
| getMileageStatistics(context, StatisticPeriod period)                                                                                                                                                                | getMileageDetailsStatistics(period: StatisticPeriod)                                                                                                                                      |
| getPhoneDetailStatistics(context, StatisticPeriod period)                                                                                                                                                            | getPhoneDetailStatistics(period: StatisticPeriod)                                                                                                                                         |
| getSpeedDetailStatistics(context, StatisticPeriod period)                                                                                                                                                            | getSpeedDetailStatistics(period: StatisticPeriod)                                                                                                                                         |
| void registerCallback(TrackingStateListener listener)                                                                                                                                                                | registerCallback(listener: TrackingStateListener): Boolean                                                                                                                                |
| -                                                                                                                                                                                                                    | unregisterCallback(listener: TrackingStateListener): Boolean                                                                                                                              |
| -                                                                                                                                                                                                                    | getTrackStartDate(): Long                                                                                                                                                                 |
| -                                                                                                                                                                                                                    | <p>registerSpeedViolations(</p><p>       speedLimitKmH: Float,</p><p>       speedLimitTimeoutMs: Long,</p><p>       listener: SpeedViolationsListener</p><p>): Boolean</p>                |
| -                                                                                                                                                                                                                    | unregisterSpeedViolations(): Boolean                                                                                                                                                      |
| -                                                                                                                                                                                                                    | isSpeedViolationsRegistered() : Boolean                                                                                                                                                   |
| -                                                                                                                                                                                                                    | getSpeedLimit(): Float                                                                                                                                                                    |
| -                                                                                                                                                                                                                    | getTimeouts(): Long                                                                                                                                                                       |
| ACCURACY\_HEIGHT                                                                                                                                                                                                     | Settings.getAccuracyHigh()                                                                                                                                                                |
| STOP\_TRACKING\_TIME\_HEIGHT                                                                                                                                                                                         | Settings.getStopTrackingTimeHigh()                                                                                                                                                        |
| ic\_status\_bar.png                                                                                                                                                                                                  | ic\_tracking\_sdk\_status\_bar.png                                                                                                                                                        |
| ic\_notification.png                                                                                                                                                                                                 | ic\_tracking\_sdk\_notification.png                                                                                                                                                       |


# \*Check SDK Installation

Use these tools to check your SDK

{% content-ref url="/pages/-MX3jpXY9Qh28ztgzJfT" %}
[iOS Simulator](/sdk-installation/check-your-sdk-installation/ios-simulator)
{% endcontent-ref %}

{% content-ref url="/pages/-MERdEe4rFGR3D-sQbpl" %}
[DataTool](/sdk-installation/check-your-sdk-installation/datatool)
{% endcontent-ref %}

{% content-ref url="/pages/-MGEaB3D0JAN2reKDdag" %}
[ZenRoad](/sdk-installation/check-your-sdk-installation/zenroad)
{% endcontent-ref %}


# iOS Simulator

Use Xcode to run a simulator

{% embed url="<https://youtu.be/_nuyM7kLiNI>" %}


# DataTool

Check your SDK integration | Telematics Data and User Permissions | Export telematics data to check user activity | Heartbeats API

Follow to your DataHub account and find [**DataTool**](https://userdatahub.com/datatool).

![](/files/-MWAEnzQ8aYh7OpZxRxs)

## Check User

Search users by deviceToken, Email, Phone or Client ID

![DataTool | Check User](/files/-MGEZgHvgTmGM02hnHvk)

### SDK Status API | Heartbeats

{% hint style="success" %}
**NOTE:** You can always request for SDK status via this API: <https://docs.telematicssdk.com/platform-features/heartbeats>
{% endhint %}

{% content-ref url="/pages/-MNbFsHb8L9Esa7xvTI0" %}
[\*User & Permissions Status | Heartbeats](/platform-features/heartbeats)
{% endcontent-ref %}

## User

In this section you can find main user information

## SDK

### Heartbeats

{% hint style="info" %}
Heartbeats - a system information that we receive from SDK in background. Average period of heartbeats is around 2 hours, but it also depends on user's connection to Internet.

Heartbeats help to indicate that the user has an installed application with active SDK and also shows all below information.
{% endhint %}

**Trips on device** - this indicator shows how many trips hasn't been sent from the SDK to our servers yet. The trips are always sent only if the internet connection is stable enough.

**Last Date heartbeat** - the date of last received heartbeat. If the date is more than 24 hours ago, it usually means that the users has removed the application or has no internet connection for this period or has some issues with permissions or issues with a smartphone.

**SDK Version** - SDK version that was installed in the application at the moment this latest heartbeat was sent.

### Services

**Tracking** - indicator that shows that the main trip tracking was enabled for this device when the latest heartbeat was received

**RealTimeLocation -** indicator that shows that the realtime location tracking was enabled for this device when the latest heartbeat was received

**Logging -** indicator that shows that the logging (system information that can help our developers to easily find any issue) was enabled for this device when the latest heartbeat was received

####

### Telematics Data (Latest 7 days)

![](/files/-MGE_XPS6F-rfsNCdIfg)

**Received Tracks** - the tracks that we received from SDK on our servers

**Invalid Tracks** - the tracks that have any mistakes

**Process Tracks** - the tracks that are valid and were passed through telematics platform

**Excluded Tracks** - the tracks that were excluded due to any wrong information (for example, the speed of the track was not high enough)

**Enriched Tracks** - the tracks that we indicate as driving trips. These trips user can see in the application and these trips are also shown in DataHub and other interfaces (API).

**Last Track Date** - Last Enriched Track Date

**Last known Latitude and Longitude** - Latest known location.

###

## Device

**Device Model** - the model of a smartphone that was used when the latest heartbeat was sent

**Device OS Version** - the OS platform and version that was used when the latest heartbeat was sent

###

### Status of Application and Device Permissions

{% hint style="warning" %}
This section helps to indicate if correct app permissions were set up and if it is a good internet connection, so the tracking will work correctly.
{% endhint %}

## Export Data

In this section you can easily export telematics data, including the heartbeats history.

![](/files/-MGEcPqTyJt6T8IIuy4h)


# ZenRoad

ZenRoad - our Demo application that can help you investigate if tracking in your app works correctly.

{% hint style="info" %}

1. Download this application on the same smartphone that is used to test SDK integration.
2. Make test trips.
3. Compare trips in ZenRoad app with trips in your application.
   {% endhint %}

**ZenRoad iOS:** [**https://apps.apple.com/us/app/zenroad/id1432161345**](https://apps.apple.com/us/app/zenroad/id1432161345)

**ZenRoad Android:** [**https://play.google.com/store/apps/details?id=com.raxeltelematics.zenroad**](https://play.google.com/store/apps/details?id=com.raxeltelematics.zenroad)


# \*Demo Applications

### Please, use these examples to investigate how Telematics SDK should be implemented into your own application.

It's highly recommended to use exactly these schemes in your own application.&#x20;

{% content-ref url="/pages/-MTet\_a9lAY-3uPxbXsU" %}
[Broken mention](broken://pages/-MTet_a9lAY-3uPxbXsU)
{% endcontent-ref %}

{% content-ref url="/pages/-LuchtTfa77cQMSZnNtB" %}
[Broken mention](broken://pages/-LuchtTfa77cQMSZnNtB)
{% endcontent-ref %}

{% content-ref url="/pages/-MFp8uk9crLjvriFkrAQ" %}
[Broken mention](broken://pages/-MFp8uk9crLjvriFkrAQ)
{% endcontent-ref %}

{% content-ref url="/pages/-MFpBfkcZOT3UQ0AlRbA" %}
[Broken mention](broken://pages/-MFpBfkcZOT3UQ0AlRbA)
{% endcontent-ref %}

{% content-ref url="/pages/-MRe6rlQIzfRqB7-djOf" %}
[Broken mention](broken://pages/-MRe6rlQIzfRqB7-djOf)
{% endcontent-ref %}

{% content-ref url="/pages/-MYxmV72WGL-NN6G6-uf" %}
[Broken mention](broken://pages/-MYxmV72WGL-NN6G6-uf)
{% endcontent-ref %}


# SDK Changelog

Stay in touch with our updates to keep your SDK always in trend

{% content-ref url="/pages/-LtcgNhwFQ2VrJxf\_Kl-" %}
[Android SDK Changelog](/sdk-installation/changelog/android-changelog)
{% endcontent-ref %}

{% content-ref url="/pages/-LtcgIB5HTHj29DYU-sx" %}
[iOS SDK Changelog](/sdk-installation/changelog/ios-changelog)
{% endcontent-ref %}


# Android SDK Changelog

Stay in touch with our updates to keep your Android SDK always in trend

**Version 2.2.252, release date** **01.05.21 at 20:00**

* Performance enhancements

**Version 2.2.251, release date** **27.05.21 at 20:00**

* Minor fixes related tracks creation

**Version 2.2.250, release date** **17.04.21 at 20:00**

* Minor fixes related to heartbeats
* Performance enhancements

**Version 2.2.249, release date** **08.04.21 at 20:00**

* Minor fixes related to location processing
* Performance enhancements

**Version 2.2.246, release date** **10.03.21 at 20:00**

* Minor fixes related to heartbeats&#x20;
* Performance enhancements

**Version 2.2.245, release date** **20.02.21 at 20:00**

* Added [tracking event receiver](/sdk-installation/android-sdk-installation/subscribe-to-tracking-events)
* Removed:

  `registerSpeedViolationsIntent`\
  `registerLocationListenerIntent`\
  `registerDeprecatedSdkIntent`
* Performance enhancements

**Version 2.2.243, release date** **10.02.21 at 20:00**

* Added [incoming tags managing](/sdk-installation/android-sdk-installation/incoming-tags-managing)
* Added changes to [permissions wizard](/sdk-installation/android-sdk-installation/setup-and-enabling-sdk/permissions-wizard) and [permissions dialog](/sdk-installation/android-sdk-installation/setup-and-enabling-sdk/permissions-dialog) related to target sdk 30

**Version 2.2.231, release date** **12.01.21 at 20:00**

* Added **prominent disclosure** to the permissions dialog (related to the new Google's policies)

**Version 2.2.230, release date** **12.12.20 at 12:00**

* Added capability to get broadcasts about new location, speed violation and deprecated sdk via the methods:\
  `registerSpeedViolationsIntent`\
  `registerLocationListenerIntent`\
  `registerDeprecatedSdkIntent`
* Minor changes under the hood

**Version 2.2.229, release date** **07.12.20 at 12:00**

* Minor changes under the hood
* Fixed issue with incorrect GPS-time
* Performance enhancements

**Version 2.2.228, release date** **13.11.20 at 12:00**

* Added capability for register a callback to be invoked when new location was found
* Fixed critical bug related permissions checking
* Fixed bug related GPS-sensor unavailable or turned off message
* Technical improvements related scoped storage

**Version 2.2.225, release date** **09.10.20 at 15:00**

* Improvements for Android 11
* Removed Storage permission. Now we are not using phones external storage
* Added return parameter to `changeTrackOrigin` method
* [Updated permissions wizard](https://docs.telematicssdk.com/sdk-installation/android-sdk-installation/new-permissions-wizard-since-2.2.225-version)
* Bug fixes
* Performance enhancement

**Version 2.2.223, release date** **01.10.20 at 15:00**

* Fixed bug related enabling GPS sensor in permissions dialog
* Technical improvements under the hood

**Version 2.2.218, release date 12.08.20 at 15:00**

* Improvements in registering ELM devices
* Bug fixes
* Performance enchacements

**Version 2.2.217, release date 10.07.20 at 18:23**

* ELM device connection
* High frequency events
* Bug fixing&#x20;

**Version 2.0.59, release date 06.04.20 at 23:45**

* &#x20;Extended statistics methods with track tag optional filter.

**Version 2.0.58, release date 23.03.20 at 23:45**

* &#x20;Hotfix - "GPS sensor enable" crash on PermissionDialogFragment fixed

**Version 2.0.57, release date 20.03.20 at 08:45**

* [Tags for trips and methods for get/add/remove these tags](/sdk-features/tags/trip-tag/android-enriched-tags-for-individual-trips)

**Version 2.0.50, release date 13.02.20 at 15:00**

* Return track tags in getTracks/getTrackDetails methods
* Improve tracking functionality

**Version 2.0.48, release date 30.10.19 at 22:28**

* Permissions wizard and dialog
* Cache for tracks and track details
* Migrate to AndroidX
* Support Android 10, target SDK 29

**Version 2.0.25, release date 13.09.19 at 22:28**

* Fix SpeedViolation speed value from m/s to km/h.
* Improve phone usage detecting

**Version 2.0.23, release date 26.07.19 at 13:17**

* Fix documentation for TrackingApi
* Fix - convert speed in meters/second to km/H when check speed limits

**Version 2.0.20, release date 11.07.19 at 19:03**

* TrackDetails and Track models extended: address start and finish added
* Speed violations implemented

**Version 2.0.14, release date 10.06.19 at 17:34**

* Few more logs added.
* Log folder name changed.

**Version 2.0.11, release date 04.06.19 at 18:37**

* Portugal and Spanish languages support added for getTracks, getTrackDetails, getTrackOriginDict methods

**Version 2.0.7, release date 27.05.19 at 18:47**

* Android foreground service bug fixed

**Version 2.0.4, release date 24.05.19 at 14:38**

* Fix big icon issue
* Change icons name

**Version 2.0.2, release date 13.05.19 at 19:55**

* Fix TrackingApi docs
* Minor fixes

**Version 1.6.91, release date 24.04.19 at 20:48**

* Migration to Kotlin - TrackingApi class for SDK entries, Remove old SDK Java models
* Added track start date to SDK API
* Insurance removed

**Version 1.6.86, release date 17.04.19 at 12:28**

* Fix "isRunning" method

**Version 1.6.85, release date 05.03.19 at 15:58**

* All notification must disappear after setEnableSdk(false) - fixed


# iOS SDK Changelog

Stay in touch with our updates to keep your iOS SDK always in trend

####

#### Version 5.9.17 Release date 31.05.2021

* background optimisation for 12.5.1 and later

#### Version 5.9.10 Release date 18.03.2021

* added track restoration

#### Version 5.9.5 Release date 11.02.2021

* driving events like acceleration, breaking and etc in trip time by delegate

#### Version 5.9.4 Release date 05.02.2021

* tags for trip with offline mode

**Version 5.9.3 Release date 22.01.2021**

* tags for trip

**Version 5.9.2 Release date 20.01.2021**

* added new upload for tracks

#### Version 5.9.0 Release date 22.12.2020

* [Aggressive heartbeats mode](/sdk-installation/ios-sdk-intallation/sdk-modes)
* Improvements of quality for start and stop tracking&#x20;
* More energy effective and energy safe

#### Version 5.8.0 Release date 15.11.2020

* iOS 14 support
* Best quality for start and stop tracking&#x20;
* [Wrong Accuracy and low battery mode delegates](https://docs.telematicssdk.com/sdk-installation/ios-sdk-intallation/sdk-delegates)

#### Version 5.7.0 Release date 13.11.2020

* Added update location delegate.

#### Version 5.6.0 Release date 30.06.2020

* [Added isAllRequiredPermissionsGranted property.](https://docs.telematicssdk.com/sdk-installation/ios-sdk-intallation/ios-13-permissions-wizard#required-permissions-granted)&#x20;
* [Added high frequency functionality for event detection. ](https://docs.telematicssdk.com/sdk-installation/ios-sdk-intallation/configure-framework#high-frequency-functionality-for-event-detection-for-enable-use-enablehf)
* [Added ELM functionality for work with OBD devices in your cars.](https://docs.telematicssdk.com/sdk-installation/ios-sdk-intallation/configure-framework#elm-functionality)

#### Version 5.5.13 Release date 01.06.2020

* Fix for more stability

#### Version 5.5.12 Release date 12.05.2020

RPRegionDelegate

* (**void**)locationManager:(CLLocationManager \*)manager didExitRegion:(CLRegion \*)region;

\[RPEntry instance].regionDelegate

#### Version 5.5.11 Release date 06.04.2020

* Hot Fix for short tracks.

#### Version 5.5.10 Release date 06.04.2020

Added new methods to get statistics with TAGs

* (void)getDashboardInfoByTrackTag:
* (void)getDrivingTimeStatistics:
* (void)getDrivingDetailsStatistics:
* (void)getSpeedDetailStatistics:
* (void)getMileageDetailsStatistics:
* (void)getPhoneDetailStatistics:

#### Version 5.5.9 Release date 23.03.2020

1. Added isTracking. Equal isActive for tracking state.
2. Added RPTrackingStateListenerDelegate and method (**void**)trackingStateChanged:(Boolean)state;\
   This delegate method called all times when SDK start or stop tracking.
3. Added New methods for get Statistics.\
   getDrivingDetailsStatistics, getSpeedDetailStatistics, getMileageDetailsStatistics, getPhoneDetailStatistics
4. [TAGs for trips and methods to get, add, remove these tags](/sdk-features/tags/trip-tag/ios-enriched-tags-for-individual-trips).
5. FixBug causing a long interval for the end of the trip. (manifested at the end of the trip in the car and did not start walking part)

#### Version 5.5.8 Release date 27.02.2020

* Start Reasons
* Start and stop trip detection improvement

#### Version 5.5.7 Release date 19.02.2020

* Tag trips

#### Version 5.5.6 release date 14.02.2020

* Upload Manager - Significant improvement of upload tracks algorithm
* Permission wizard fixes
* Bug fixes

#### Version 5.5.4 release date 20.09.2019 for Xcode 10.3 and before + Version 5.5.5 release date 20.09.2019 for Xcode 11.0 and later

* Added Wizard for iOS 13 (View based wizard for permissions legend and how it works in iOS 13).
* New mechanics of giving permissions for iOS 13.\
  (Please, read the ["What's different in iOS 13?"](/sdk-installation/ios-sdk-intallation/whats-different-in-ios-13) article)

#### **Version 5.5.3 release date 15.08.2019**

* More detailed ratings, added: \
  "RatingCornering": 0..5, \
  "RatingAcceleration": 0..5, \
  "RatingBraking": 0..5, \
  "RatingSpeeding": 0..5, \
  "RatingPhoneUsage": 0..5, \
  "RatingTimeOfDay": 0..5,
* Increased accuracy and added detecting of stop reason.
* Added delegate method for alert about speed overage 100 km\h


# Permissions Guides

{% content-ref url="/pages/-MS7bma5y-9TodP4Z7as" %}
[First Launch](/sdk-installation/permissions-guides/first-launch)
{% endcontent-ref %}

{% content-ref url="/pages/-MS7bs4WmG1OYxGjJOtm" %}
[\*Troubleshooting](/sdk-installation/permissions-guides/troubleshooting)
{% endcontent-ref %}


# First Launch

## iOS

{% content-ref url="/pages/-MS7b45VCoWq7htJeXak" %}
[Broken mention](broken://pages/-MS7b45VCoWq7htJeXak)
{% endcontent-ref %}

{% content-ref url="/pages/-MS7bAaLQ2\_W3HubNkL5" %}
[Broken mention](broken://pages/-MS7bAaLQ2_W3HubNkL5)
{% endcontent-ref %}

## Android

{% content-ref url="/pages/-MS7bH8PFMN9vS-\_avsx" %}
[Broken mention](broken://pages/-MS7bH8PFMN9vS-_avsx)
{% endcontent-ref %}

{% content-ref url="/pages/-MS7bPef0tvWIllev\_9z" %}
[Broken mention](broken://pages/-MS7bPef0tvWIllev_9z)
{% endcontent-ref %}

{% content-ref url="/pages/-MS7bZd0cpZSZA5jP5Xp" %}
[Broken mention](broken://pages/-MS7bZd0cpZSZA5jP5Xp)
{% endcontent-ref %}


# \*Troubleshooting

{% content-ref url="/pages/-MS7c\_Pm2TZoxS-nUR4e" %}
[iOS — Troubleshooting](/sdk-installation/permissions-guides/troubleshooting/ios-troubleshooting)
{% endcontent-ref %}

{% content-ref url="/pages/-MS7imF1vvtkDVLxNNmM" %}
[Android — Troubleshooting](/sdk-installation/permissions-guides/troubleshooting/android-troubleshooting)
{% endcontent-ref %}


# iOS — Troubleshooting

{% content-ref url="/pages/-MS7fqlgAg0-Rl67OBpa" %}
[Broken mention](broken://pages/-MS7fqlgAg0-Rl67OBpa)
{% endcontent-ref %}


# Android — Troubleshooting

{% content-ref url="/pages/-MS7iiSl89Ze3Vjxw\_hN" %}
[Broken mention](broken://pages/-MS7iiSl89Ze3Vjxw_hN)
{% endcontent-ref %}

{% content-ref url="/pages/-MS81jALAunjWc\_flXsn" %}
[Broken mention](broken://pages/-MS81jALAunjWc_flXsn)
{% endcontent-ref %}

{% content-ref url="/pages/-MS83kjWrWTTO0h0mCqe" %}
[Broken mention](broken://pages/-MS83kjWrWTTO0h0mCqe)
{% endcontent-ref %}

{% content-ref url="/pages/-MS8598zEeEw5-ETAHmT" %}
[Broken mention](broken://pages/-MS8598zEeEw5-ETAHmT)
{% endcontent-ref %}

{% content-ref url="/pages/-MS86mN1E\_8d8VhdJIrp" %}
[Broken mention](broken://pages/-MS86mN1E_8d8VhdJIrp)
{% endcontent-ref %}

{% content-ref url="/pages/-MS87HAFjnoJgiN1nSAF" %}
[Broken mention](broken://pages/-MS87HAFjnoJgiN1nSAF)
{% endcontent-ref %}

{% content-ref url="/pages/-MS87svwHG9T77H0Xw07" %}
[Broken mention](broken://pages/-MS87svwHG9T77H0Xw07)
{% endcontent-ref %}

{% content-ref url="/pages/-MS88LNKKvqJy1AxP544" %}
[Broken mention](broken://pages/-MS88LNKKvqJy1AxP544)
{% endcontent-ref %}

{% content-ref url="/pages/-MS899KynkZl67tyldG8" %}
[Broken mention](broken://pages/-MS899KynkZl67tyldG8)
{% endcontent-ref %}


# Step 3: Register SDK users

Full stack of operations with users and users' profiles

### API Reference

{% content-ref url="/pages/-MYdkozjiMj5zGUdCAIK" %}
[Broken mention](broken://pages/-MYdkozjiMj5zGUdCAIK)
{% endcontent-ref %}

{% content-ref url="/pages/-LuUmX-1A1Kf56uZIEPl" %}
[Broken mention](broken://pages/-LuUmX-1A1Kf56uZIEPl)
{% endcontent-ref %}

## Introduction

This step plays a significant role in SDK installation. You have to register your app user on telematics platform and get devicetoken that you will add to the sdk. to register a user, you have to call **user service API**.&#x20;

DeviceToken **(Virtual device)** is a unique ID that belongs to a sure and it is used by sdk to transfer data to the platform.

Devicetoken = user

To obtain a DeviceToken you have to register users in is used as an identifier to link depersonalized telematics data with app user.&#x20;

## Integration options

there are several options for how you can register users. The final goal is to have Devicetoken in your database against the user record.

1. Register users from your mobile app and update user details by adding devicetoken
2. Register user from your back-end and store a devicetoken with user profile.

**User Service**, then keep the device token against a user account in your database.

![](/files/-MPzNfqi1EfkiCfeMOvY)

User service is a full-end service for user management. The main role of the service is to keep a unique user ID (Device Token) which used as a unique key to start collecting and transferring telematics data by telematics SDK. The service contains fields sufficient to build a full user profile if it is needed.

The rules of the service depend on a product selected in [SandBox](https://docs.userdatahub.com)

{% hint style="info" %}
**Telematics SDK.** no mandatory parameters. you can create a device token by a simple request without providing any parameters. However, we recommend to add some identifiers that you will use in DataHub to search users. if no paratemers provided, you will have in datahub a device token only.&#x20;
{% endhint %}

{% hint style="info" %}
**Platform.** Email or phone number are required. Given that the platform product is mainly used as a back-end service for mobile app, the parameters (email or phone number) will play a role of Login. However, we recommend adding more identifiers that you will use in DataHub to search users. if no parameters provided, you will have in datahub a device token and email or phone only.&#x20;
{% endhint %}


# User Registration (API)

Full stack of operations with users and users' profiles.

Please make sure you have **InstanceID** and **InstanceKey** ready. If not, please refer to the part of [account registration ](/acc_reg)

{% content-ref url="/pages/-LuUmX-1A1Kf56uZIEPl" %}
[Broken mention](broken://pages/-LuUmX-1A1Kf56uZIEPl)
{% endcontent-ref %}

## Telematics parameters

{% hint style="info" %}
User service enables managing user's telematics parameters. It can be set up during registration or changed later via  [**Update User**](/platform-features/back-end-as-a-service) method. This parameters will be used by default if you do not set up them manually.
{% endhint %}

| Parameter              | Description                                                                                                                                                                         |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| "EnableTracking"       | Activate/Deactivate SDK tracking                                                                                                                                                    |
| EnableLogging          | Activate/Deactivate debug mode (**IMPORTANT:** this option causes a greater battery consumption. Use it carefully only while debugging!)                                            |
| EnableRealtimeLocation | Activate/Deactivate online location monitoring                                                                                                                                      |
| Enabled                | Activate/Deactivate user (Note: deactivated user is not a deleted user. If you need to permanently delete user, use [Delete User](/platform-features/back-end-as-a-service) method) |

## Register a new user

<mark style="color:green;">`POST`</mark> `http://user.telematicssdk.com/v1/Registration/Create`

Register a new user. The method returns DeviceToken that will be placed to telematics SDK and will play a role of an identifier to link telematics data with app user.\
\
**Authorization:** Allow anonymous

#### Headers

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| InstanceID  | string | //required  |
| InstanceKey | string | //required  |

{% tabs %}
{% tab title="200 Success" %}

```
{
  "Result": {
    "DeviceToken": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "AccessToken": {
      "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MmU4M2U2ZS00YmQxLTQzNTMtYThjMS02ZGY2YzJhMzJhM2QiLCJqdGkiOiJlZWEwMjlmMS01MGY1LTQyYTMtYTNiOS0zMTgyMGI3YjkxZjIiLCJpYXQiOjE1NzY0MDAzNTcsIkFwcGxpY2F0aW9uSWQiOiIxMDAyIiwiU2RrRW5hYmxlTG9nZ2luZyI6IkZhbHNlIiwiU2RrRW5hYmxlVHJhY2tpbmciOiJUcnVlIiwiU2RrRW5hYmxlUmVhbFRpbWVMb2NhdGlvbiI6IkZhbHNlIiwiU2RrQ2xpZW50SWQiOiIiLCJJbnN0YW5jZUlkIjoiM2MxYzhmZDctNDEzMy00MDRhLTgyZTktOTNhMDE1ZDg1MzYyIiwiSW5zdGFuY2VLZXkiOiIxYjdjYzI1Zi0zMjllLTQ0ODItOWRkMS0wYmIwN2MwYzc5NGIiLCJEZXZpY2VUb2tlbiI6IjUyZTgzZTZlLTRiZDEtNDM1My1hOGMxLTZkZjZjMmEzMmEzZCIsIkNvbXBhbnlJZCI6IjMiLCJSZWZyZXNoVG9rZW5FeHBpcmVkRGF0ZSI6IjIyLjEyLjIwMTkgODo1OTowOSIsIlJlZnJlc2hUb2tlbiI6InhacnN0MjF1SjN6cGw1Mmgybi9wUXM3eUVsYTZ6ZmthcDFWT2hnYUhOUVE9IiwibmJmIjoxNTc2NDAwMzU3LCJleHAiOjE1NzY0MDc1NTcsImlzcyI6IndlYkFwaSIsImF1ZCI6Imh0dHA6Ly9sb2NhbGhvc3Q6NTEzNzQvIn0.5z6eRrKUvI5d0hkjgrOcjPSpCRPsj12uKPkTvKBZ4hI",
      "ExpiresIn": 7200
    },
    "RefreshToken": "xZrst21uJ3zpl52h2n/pQs7yEla6zfkap1VOhgaHNQQ="
  },
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
For transition period we are using Device Token, however it will be replaced with JWT token soon.

Here you can find information about how JWT works: <https://jwt.io/introduction/>

For the purpose of smooth transition, we recommend you to store JWT token and refresh token together with Device ID. Once we will be ready to move to JWT Token we will inform our clients respectively. Device Token will be supported over 12 month since announcement.

JWT token has a lifetime. After this period - it expires. When your JWT token is expired you should refresh your token.

We will support the old platform till November 01, 2021 and keep inform all our clients about progress and required steps.
{% endhint %}

{% hint style="warning" %}
Important: JWT Token will be used in other API Requests.
{% endhint %}

Optionally you can add user information to User Service as well as manage SDK tracking and data collection

{% hint style="success" %}
Adding user information unlocks better experience working with DataHub. The more information you share, the more completed profile you will get in DataHub, as well as more data for portfolio categorisation.
{% endhint %}

{% tabs %}
{% tab title="Request Body" %}

```
{   
  "CreateAccessToken": true,  // default = true, - return jwt token in response for immediately using or use login to receive jwt
  "FirstName": "string",
  "LastName": "string",
  "Nickname": "string",
  "Phone": "string",
  "Email": "string",
  "Gender": "None", // { "None", "Male", "Female", "Other" }
  "Birthday": "2019-12-13T06:19:18.837Z",
  "MaritalStatus": "string",
  "ChildrenCount": 0,
  "Country": "string",
  "District": "string",
  "City": "string",
  "Status": "Active", //default = active, - you can also create the "deactivated" user
  "Address": "string",
  "ImageUrl": "string" // photo url (you can upload your photo later),
  "InstanceInviteCode": "string", // Registration in instance by invite code
  "UserFields": { // default = null. Will be using dafult values below
    "EnableTracking": true, // default = true - enable tracking user motion
    "EnableLogging": false; // default = false - enable logging on mobile device
    "Enabled": true, // default = true - enable telematics SDK
    "ClientId": "string", // default = null. User ID in your system
  }
}
```

{% endtab %}
{% endtabs %}

## Register multiple users

<mark style="color:green;">`POST`</mark> `/v1/Registration/CreateMany`

Create a bulk of users\
\
**Authorization:** Allow anonymous

#### Path Parameters

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| InstanceID  | string | //required  |
| InstanceKey | string | //required  |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": {
    "Results": [
      {
        "DeviceToken": "8eedd2d1-e873-4cf4-a641-21f478c9c7a3",
         "AccessToken": {
          "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MmU4M2U2ZS00YmQxLTQzNTMtYThjMS02ZGY2YzJhMzJhM2QiLCJqdGkiOiJlZWEwMjlmMS01MGY1LTQyYTMtYTNiOS0zMTgyMGI3YjkxZjIiLCJpYXQiOjE1NzY0MDAzNTcsIkFwcGxpY2F0aW9uSWQiOiIxMDAyIiwiU2RrRW5hYmxlTG9nZ2luZyI6IkZhbHNlIiwiU2RrRW5hYmxlVHJhY2tpbmciOiJUcnVlIiwiU2RrRW5hYmxlUmVhbFRpbWVMb2NhdGlvbiI6IkZhbHNlIiwiU2RrQ2xpZW50SWQiOiIiLCJJbnN0YW5jZUlkIjoiM2MxYzhmZDctNDEzMy00MDRhLTgyZTktOTNhMDE1ZDg1MzYyIiwiSW5zdGFuY2VLZXkiOiIxYjdjYzI1Zi0zMjllLTQ0ODItOWRkMS0wYmIwN2MwYzc5NGIiLCJEZXZpY2VUb2tlbiI6IjUyZTgzZTZlLTRiZDEtNDM1My1hOGMxLTZkZjZjMmEzMmEzZCIsIkNvbXBhbnlJZCI6IjMiLCJSZWZyZXNoVG9rZW5FeHBpcmVkRGF0ZSI6IjIyLjEyLjIwMTkgODo1OTowOSIsIlJlZnJlc2hUb2tlbiI6InhacnN0MjF1SjN6cGw1Mmgybi9wUXM3eUVsYTZ6ZmthcDFWT2hnYUhOUVE9IiwibmJmIjoxNTc2NDAwMzU3LCJleHAiOjE1NzY0MDc1NTcsImlzcyI6IndlYkFwaSIsImF1ZCI6Imh0dHA6Ly9sb2NhbGhvc3Q6NTEzNzQvIn0.5z6eRrKUvI5d0hkjgrOcjPSpCRPsj12uKPkTvKBZ4hI",
          "ExpiresIn": 7200
        },
        "RefreshToken": "otCqu3EL9FSdml9jKhzq4G+hrD6AxZcgo6pUjI1mhqQ="
      },
      {
        "DeviceToken": "72466e2b-a99d-4311-92cb-d977a1eb36ea",
        "AccessToken": {
          "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MmU4M2U2ZS00YmQxLTQzNTMtYThjMS02ZGY2YzJhMzJhM2QiLCJqdGkiOiJlZWEwMjlmMS01MGY1LTQyYTMtYTNiOS0zMTgyMGI3YjkxZjIiLCJpYXQiOjE1NzY0MDAzNTcsIkFwcGxpY2F0aW9uSWQiOiIxMDAyIiwiU2RrRW5hYmxlTG9nZ2luZyI6IkZhbHNlIiwiU2RrRW5hYmxlVHJhY2tpbmciOiJUcnVlIiwiU2RrRW5hYmxlUmVhbFRpbWVMb2NhdGlvbiI6IkZhbHNlIiwiU2RrQ2xpZW50SWQiOiIiLCJJbnN0YW5jZUlkIjoiM2MxYzhmZDctNDEzMy00MDRhLTgyZTktOTNhMDE1ZDg1MzYyIiwiSW5zdGFuY2VLZXkiOiIxYjdjYzI1Zi0zMjllLTQ0ODItOWRkMS0wYmIwN2MwYzc5NGIiLCJEZXZpY2VUb2tlbiI6IjUyZTgzZTZlLTRiZDEtNDM1My1hOGMxLTZkZjZjMmEzMmEzZCIsIkNvbXBhbnlJZCI6IjMiLCJSZWZyZXNoVG9rZW5FeHBpcmVkRGF0ZSI6IjIyLjEyLjIwMTkgODo1OTowOSIsIlJlZnJlc2hUb2tlbiI6InhacnN0MjF1SjN6cGw1Mmgybi9wUXM3eUVsYTZ6ZmthcDFWT2hnYUhOUVE9IiwibmJmIjoxNTc2NDAwMzU3LCJleHAiOjE1NzY0MDc1NTcsImlzcyI6IndlYkFwaSIsImF1ZCI6Imh0dHA6Ly9sb2NhbGhvc3Q6NTEzNzQvIn0.5z6eRrKUvI5d0hkjgrOcjPSpCRPsj12uKPkTvKBZ4hI",
          "ExpiresIn": 7200
        },
        "RefreshToken": "lPHZM7PrtiFPdtGn9bhS4H5z8sFRQtmSAD6td6QkXbg="
      }
    ]
  },
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Request Body" %}

```
{
  "Quantity": 0,  // required
  "CreateAccessToken": true, // default = true
  "CustomFields": {
    "EnableTracking": true, // default = true
    "EnableLogging": false; // default = false
    "Enabled": true, // default = true
  }  
}
```

{% endtab %}
{% endtabs %}

## Refresh Token

{% hint style="info" %}
For any actions use JWT token. You can get it after registration (if GenerateAccessToken = true), Authorization and after RefreshToken.<br>

**Using:** got 401 Error => refresh token => new JWT and refresh token.\
Refresh token changes when Login and RefreshToken.
{% endhint %}

## RefreshToken

<mark style="color:green;">`POST`</mark> `https://user.telematicssdk.com/v1/RefreshToken`

**Authorization:** Allow Anonymous

#### Request Body

| Name         | Type   | Description                                                       |
| ------------ | ------ | ----------------------------------------------------------------- |
| AccessToken  | string | The access token that should be refreshed                         |
| RefreshToken | string | Refresh token received with access token that should be refreshed |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": {
    "DeviceToken": "string",
    "AccessToken": {
      "Token": "jwt token",
      "ExpiresIn": 7200
    },
    "RefreshToken": "new refresh token"
  },
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

**Format of Body Request:**

```
{
  "AccessToken": "string", // required - JWT
  "RefreshToken": "string" // required
}
```

**Get more information about user management including Tracking activation and deactivation:**&#x20;

{% content-ref url="/pages/-M2UNQ8AbRC1nf3aX-YY" %}
[\*User Management](/platform-features/back-end-as-a-service)
{% endcontent-ref %}


# Step 4: Get Statistics, Scorings and Trip Data

## Platform API

There are 2 APIs available

| API                                                                                | Description                                                                                                                                        |
| ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| [User Statistics](https://docs.telematicssdk.com/back-end-to-back-end-integration) | Driving statistics including general information like mileage, speed, time of driving, etc. as well as safe drive scoring and eco-driving scoring. |
| [Telematics data](/user-statistics-and-analytics/processed-data)                   | Data related to tracks, including a list of trips and detailed trip information including waypoints                                                |

{% content-ref url="/pages/-MYdkozjiMj5zGUdCAIK" %}
[Broken mention](broken://pages/-MYdkozjiMj5zGUdCAIK)
{% endcontent-ref %}

{% content-ref url="/pages/-M2cbbSRbIXaO9xQ9y0l" %}
[API Authorization](/user-statistics-and-analytics/authentication)
{% endcontent-ref %}

{% content-ref url="/pages/-Ltikkd2wma\_QBoA4UWk" %}
[Statistics and Scoring APIs](/user-statistics-and-analytics/get-started-statistics-and-scoring-apis)
{% endcontent-ref %}

{% content-ref url="/pages/-LtwSbMCxF\_4D03284b4" %}
[Trips API](/user-statistics-and-analytics/processed-data)
{% endcontent-ref %}


# API Authorization

Get access to Telematics API

Authorization methods are located in User-service.

{% content-ref url="/pages/-LuUmX-1A1Kf56uZIEPl" %}
[Broken mention](broken://pages/-LuUmX-1A1Kf56uZIEPl)
{% endcontent-ref %}

{% hint style="danger" %}
**VERY IMPORTANT! Read it carefully:**&#x20;

Almost all responses contain DeviceToken, AccessToken and RefreshToken. We are currently in transition period of moving to a new platform. The existing platform already operates both with DeviceToken and AccessToken. We strongly recommend to store all three tokens to smoothly switch between platforms in the nearest future.\
\
After registration you will receive accessToken with JWT and refreshToken. Use JWT token for user's authorized requests. JWT token has a lifetime. After this period - it expires. When your JWT token is expired you should refresh your token.\
\
Here you can find information about how JWT works: <https://jwt.io/introduction/>\
\
We will support the old platform till November 01, 2021 and keep inform all our clients about progress and required steps.
{% endhint %}

{% hint style="warning" %}
To get and manage data of individual user you need to authorize with user's deviceToken (or JWT token in some cases), user's InstanceID and InstanceKey.\
\
To get and manage consolidated and accumulated data of user groups and all other users separately from your back-end, you need to authorize in API as admin with API Authorization Credentials.
{% endhint %}

## Authorization Types

| **API Services with authorization required**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | **Authorization type**                                | **How to authorize in API**                                                                                                                                      |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <ul><li><a href="https://docs.telematicssdk.com/back-end-to-back-end-integration/user-statistics-1/individual-statistics-and-scorings">Individual user Statistics and Scorings API</a></li><li><a href="https://docs.telematicssdk.com/platform-features/streaks#individual-streaks">Individual user's Streaks</a></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Authorize as User                                     | <p><strong>InstanceID:</strong> User Group InstanceID</p><p><strong>Login:</strong> User DeviceToken</p><p><strong>Password:</strong> User Group InstanceKEY</p> |
| <ul><li><a href="/pages/-M2UNQ8AbRC1nf3aX-YY">User Management API</a></li><li><a href="https://docs.telematicssdk.com/back-end-to-back-end-integration/user-statistics-1/accumulated-statistics-and-scorings">Accumulated Statistics and Scorings API</a> by a single user or a list of users in a single User Group (InstanceID)  </li><li><a href="/pages/-MK0vqevT_JE3bXP_nuu">Consolidated Statistics and Scorings API</a> by a single User Group (InstanceID)</li><li><p><a href="https://docs.telematicssdk.com/platform-features/streaks#accumulated-streaks">Accumulated Streaks</a> by a single user or a list of users in a single User Group (InstanceID)  </p><p> </p></li><li><a href="https://docs.telematicssdk.com/platform-features/heartbeats">Heartbeats</a> (User(s) Permissions status)</li></ul> | Authorize as Admin with API Authorization Credentials | <p><strong>InstanceID:</strong> API InstanceID</p><p><strong>Login:</strong> API Login</p><p><strong>Password:</strong> API Password</p>                         |

## API Authorization Credentials

Please, follow to your **Management** page in **DataHub** and generate **API Authorization Credentials**. Use provided credentials to get access to API.\
*If you do not have access to Management page - please, ask your colleague with a Company Access to DataHub to provide you with these credentials.*

![API Authorization Credentials](/files/-MIdZqNvEjFF2Sjt7xLC)

## Authorization

<mark style="color:green;">`POST`</mark> `https://user.telematicssdk.com/v1/Auth/Login`

The method allows to log into API and get access to sensitive information\
\
**Authorization**: Allow Anonymous

#### Headers

| Name       | Type   | Description                               |
| ---------- | ------ | ----------------------------------------- |
| InstanceID | string | User Group Instance ID or API Instance ID |

#### Request Body

| Name        | Type   | Description                             |
| ----------- | ------ | --------------------------------------- |
| LoginFields | string | User deviceToken or API Login           |
| Password    | string | User group Instance Key or API Password |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": {
    "DeviceToken": "String",
    "AccessToken": {
      "Token": "String",
      "ExpiresIn": 1209600 // milliseconds
    },
    "RefreshToken": "String"
  },
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

### Format of body request

#### Authorize as user

```
{
  "LoginFields": {deviceToken: "deviceToken"},
  "Password": "InstanceKEY"
}
```

#### Authorize as Admin with API Authorisation Credentials

```
Authorize as Admin with API Authorization Credentials
{
  "loginFields": {"Email":"4DED@auth.me"},
  "password": "Password"
}
```

### curl Request:

{% tabs %}
{% tab title="Curl request" %}

```
curl -X POST “
https://user.telematicssdk.com/v1/Auth/Login”
 -H “accept: /” -H “InstanceId: “String” -H “InstanceKey: “String” -H “Content-Type: application/json-patch+json” -d “{\“loginFields\“:{\“Email\“:\“myemail@mydomain.com\“},\“password\“:\“P@ssword\“}”
```

{% endtab %}
{% endtabs %}

curl -X POST “<https://user.telematicssdk.com/v1/Auth/Login”> -H “accept: */*” -H “InstanceId: “String” -H “InstanceKey: “String” -H “Content-Type: application/json-patch+json” -d “{\“loginFields\“:{\“Email\“:\“<myemail@mydomain.com>\“},\“password\“:\“P\@ssword\“}”

{% hint style="danger" %}
Once you Log in and get credentials for further actions you have to be authorized. Please use Open Auth authorization.&#x20;

Use **`"Authorization": "Bearer {Token}" // required`** in header for any method when authorization required.\
{Token} - the JWT token that you get in /v1/Auth/Login response method.

Please be informed, that the accesstoken expires every 2 hours. You have to update it every 2 hours using [refresh token and method **POST /v1/Auth/RefreshToken**](broken://pages/-M2csOnXplLLP_8T_7pd)

**We recommend keeping both AccessToken and Refresh token and set a schedule to refresh AccessToken to get seamless access to telematics platform, APIs and services**
{% endhint %}

{% content-ref url="/pages/-M2csOnXplLLP\_8T\_7pd" %}
[Broken mention](broken://pages/-M2csOnXplLLP_8T_7pd)
{% endcontent-ref %}

## Authorization via Swagger

Swagger: <https://user.telematicssdk.com/swagger/index.html>

### Login

#### Request

{% hint style="info" %}
Please have API's InstanceID ready
{% endhint %}

![](/files/-MGJFw_tZu7i2Jqa3y30)

#### Response

```
{
  "Result": {
    "DeviceToken": "String",
    "AccessToken": {
      "Token": "String",
      "ExpiresIn": 1209600
    },
    "RefreshToken": "String"
  },
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

### Autorization

![](/files/-M2crSk17af82wY8UF-1)

![](/files/-M2cr4NZ_HBbU_njhMUZ)

Please add Bearer JWT to authorization form.

{% hint style="danger" %}
Make sure you used a proper format value.
{% endhint %}

#### Example of format

Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJiOTA5MDNkZi1iOWExLTQ3MzQtOWI1Yi02MDJkZGFiNmYwNmUiLCJqdGkiOiIzOGEyZmZmNi1kNmVkLTRjZGItOTRjMi1mOTk5NzIzYWUyYzMiLCJpYXQiOjE1ODQ0NTQ1MDcsIkFwcGxpY2F0aW9uSWQiOiIyMSIsIkRhdGFIdWJFbWFpbCI6ImFuZHJpeS50dXBjaGllbmtvQHJheGVsdGVsZW1hdGljcy5jb20iLCJJbnN0YW5jZUlkIjoiYThlN2I3M2YtNTA4Yi00OWNlLWFmNTItNGMwZTYwNzAxMTM2IiwiSW5zdGFuY2VLZXkiOiI2MjY5N2RiNi0xZjA1LTRlYmMtOTYzMC1iODg3MmIxNDJlMTIiLCJEZXZpY2VUb2tlbiI6ImI5MDkwM2RmLWI5YTEtNDczNC05YjViLTYwMmRkYWI2ZjA2ZSIsIkNvbXBhbnlJZCI6IjM5IiwiSXNEYXRhSHViVXNlciI6IlRydWUiLCJuYmYiOjE1ODQ0NTQ1MDcsImV4cCI6MTU4NTY2NDEwNywiaXNzIjoid2ViQXBpIiwiYXVkIjoiaHR0cDovL2xvY2FsaG9zdDo1MTM3NCJ9.Cy2c\_FowBg4Ts1aPsKILn5-uI8NcY9dVIB4w9f8a8rY

{% hint style="danger" %}
For security purpose the API will accept any value with no error message. However, if you use incorrect value, you won't be able to get information from sensitive API.
{% endhint %}


# Statistics and Scoring APIs

Driving statistics including general information like mileage, speed, time of driving, etc. as well as Risk Score and Eco-driving Score.

{% content-ref url="/pages/-M2cbbSRbIXaO9xQ9y0l" %}
[API Authorization](/user-statistics-and-analytics/authentication)
{% endcontent-ref %}

{% content-ref url="/pages/-MIdd6zHf12nqHwYMOTW" %}
[Get started - Statistics and Scoring API](/user-statistics-and-analytics/get-started-statistics-and-scoring-apis/user-statistics-1)
{% endcontent-ref %}

{% content-ref url="/pages/-LtwSbMCxF\_4D03284b4" %}
[Trips API](/user-statistics-and-analytics/processed-data)
{% endcontent-ref %}


# Get started - Statistics and Scoring API

Check this comparison page to choose the correct statistics methods according to your goals

## Use cases

|                                                                                                                                                | **User - Personal** | **Admin - User(s)**      | **Admin - Consolidated** |
| ---------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ------------------------ | ------------------------ |
| Single user (Device Token)                                                                                                                     | +                   | +                        | —                        |
| List of users                                                                                                                                  | —                   | + (by users)             | —                        |
| InstanceID / User Group                                                                                                                        | —                   | —                        | + (average)              |
| Filter by [**tags**](https://docs.telematicssdk.com/sdk-features/tags)                                                                         | +                   | +                        | +                        |
| Suits for                                                                                                                                      | **Mobile APP**      | **Back-end integration** | **Back-end integration** |
| [Authorization](https://docs.telematicssdk.com/back-end-to-back-end-integration/authentication#authorization-types) (JWT Bearer / AccessToken) | as User             | as Admin                 | as Admin                 |
| Statistics                                                                                                                                     | +                   | +                        | +                        |
| Statistics Daily                                                                                                                               | +                   | +                        | +                        |
| Risk Score                                                                                                                                     | +                   | +                        | +                        |
| Risk Score Daily                                                                                                                               | +                   | +                        | +                        |
| Eco Score                                                                                                                                      | +                   | +                        | —                        |
| Latest Scoring Date                                                                                                                            | +                   | +                        | —                        |
| Latest Track Date                                                                                                                              | +                   | +                        | —                        |

{% content-ref url="/pages/-M2cbbSRbIXaO9xQ9y0l" %}
[API Authorization](/user-statistics-and-analytics/authentication)
{% endcontent-ref %}

{% content-ref url="/pages/-MIwuMaFXm6EkQXbwQR1" %}
[Broken mention](broken://pages/-MIwuMaFXm6EkQXbwQR1)
{% endcontent-ref %}

{% content-ref url="/pages/-MIddKJrYO3WEarq5Dwe" %}
[User | Individual Scorings and Statistics](/user-statistics-and-analytics/get-started-statistics-and-scoring-apis/individual-statistics-and-scorings)
{% endcontent-ref %}

{% content-ref url="/pages/-MIddQJ8LP4FIjgvZRZs" %}
[Admin | User(s) - Scorings and Statistics](/user-statistics-and-analytics/get-started-statistics-and-scoring-apis/accumulated-statistics-and-scorings)
{% endcontent-ref %}

{% content-ref url="/pages/-MK0vqevT\_JE3bXP\_nuu" %}
[Admin | Consolidated Scorings and Statistics](/user-statistics-and-analytics/get-started-statistics-and-scoring-apis/consolidated-scorings-and-statistics)
{% endcontent-ref %}


# User | Individual Scorings and Statistics

Get Statistics and Scorings as User personaly

{% content-ref url="/pages/-MIwuMaFXm6EkQXbwQR1" %}
[Broken mention](broken://pages/-MIwuMaFXm6EkQXbwQR1)
{% endcontent-ref %}

{% hint style="warning" %}
Individual Scorings and Statistics — methods that allow to get Scorings and Statistics when **authorized as User** only!

Please, read this doc carefully before start:
{% endhint %}

{% content-ref url="/pages/-M2cbbSRbIXaO9xQ9y0l" %}
[API Authorization](/user-statistics-and-analytics/authentication)
{% endcontent-ref %}

## Individual Scorings

{% hint style="info" %}
How the aggregated 14-day scoring is counted:
{% endhint %}

{% content-ref url="/pages/-Lw3KifDldQK4-RDAVqP" %}
[Risk driving Scoring](/product-description/scoring/riskdrivingscore)
{% endcontent-ref %}

{% content-ref url="/pages/-MJ83poNeSXHiuTT2XgN" %}
[Eco Scoring](/product-description/scoring/eco-scoring)
{% endcontent-ref %}

## Individual Safe driving Scoring

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/statistics/v1/Scorings/individual`

Get an individual average scoring for requested period.\
\
**Authorization:** Required as User

#### Query Parameters

| Name      | Type   | Description                                                 |
| --------- | ------ | ----------------------------------------------------------- |
| startDate | string | 2020-09-16                                                  |
| endDate   | string | 2020-09-30                                                  |
| tag       | string | consider only tagged trips (follow to SDK features => tags) |

#### Headers

| Name          | Type   | Description                                                                  |
| ------------- | ------ | ---------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login> |

{% tabs %}
{% tab title="200 User has actual for today user scoring" %}

```
{
  "Result": 
    {
      "DeviceToken": "3fa85f64-5717-4562-b3fc-2c963f66afa3",
      "InstanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
      "AccelerationScore": 94.66666666666667,
      "BrakingScore": 78.66666666666667,
      "SpeedingScore": 40,
      "DistractedScore": 68.66666666666667,
      "CorneringScore": 100,
      "OverallScore": 69.66666666666667
    }
  ,
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

## Individual Daily Safe driving Scoring

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/statistics/v1/Scorings/individual/daily`

Get an individual daily scoring for requested period\
\
**Authorization:** Required as User

#### Query Parameters

| Name      | Type   | Description                                                 |
| --------- | ------ | ----------------------------------------------------------- |
| startDate | string | 2020-09-16                                                  |
| endDate   | string | 2020-09-30                                                  |
| tag       | string | consider only tagged trips (follow to SDK features => Tags) |

#### Headers

| Name          | Type   | Description                                                                  |
| ------------- | ------ | ---------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login> |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": [
    {
      "DeviceToken": "d71937a5-5f3a-4dc2-b449-e80d241864e4",
      "InstanceId": "3c1c8fd7-4133-404a-82e9-93a015d85362",
      "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
      "AccelerationScore": 57,
      "BrakingScore": 70,
      "SpeedingScore": 61,
      "DistractedScore": 65,
      "CorneringScore": 71,
      "OverallScore": 75,
      "CalcDate": "2020-08-01T00:00:00"
    },
    {
      "DeviceToken": "d71937a5-5f3a-4dc2-b449-e80d241864e4",
      "InstanceId": "3c1c8fd7-4133-404a-82e9-93a015d85362",
      "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
      "AccelerationScore": 61,
      "BrakingScore": 67,
      "SpeedingScore": 59,
      "DistractedScore": 66,
      "CorneringScore": 77,
      "OverallScore": 75,
      "CalcDate": "2020-08-03T00:00:00"
    }
  ],
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

## Individual Eco driving Scoring

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/statistics/v1/Scorings/individual/eco`

Get current accumulated user eco scoring\
\
**Authorization:** Required as User

#### Headers

| Name          | Type   | Description                                                                   |
| ------------- | ------ | ----------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login>) |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": [
    {
      "DeviceToken": "d71937a5-5f3a-4fc2-b449-e80d241864e4",
      "InstanceId": "3c1c8fd7-4133-405a-82e9-93a015d85362",
      "AppId": "3511c419-ea19-477d-baf0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4bgb-a40e-1f9b53f0e0be",
      "EcoScoringFuel": 99.15114,
      "EcoScoringTyres": 83.39971,
      "EcoScoringBrakes": 85.882416,
      "EcoScoringDepreciation": 99.0,
      "EcoScoring": 82.95479
    }
  ],
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

## Individual Statistics

## Individual User Statistics

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/statistics/v1/Statistics/individual/`

Get individual user statistics for requested period\
\
**Authorization:** Required as User

#### Query Parameters

| Name      | Type   | Description                                                 |
| --------- | ------ | ----------------------------------------------------------- |
| startDate | string | 2020-09-16                                                  |
| endDate   | string | 2020-09-30                                                  |
| tag       | string | consider only tagged trips (follow to SDK features => Tags) |

#### Headers

| Name          | Type   | Description                                                                   |
| ------------- | ------ | ----------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/Auth/Login>) |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result":
    {
      "DeviceToken": "d71937a5-5f3a-4dc2-b449-e80d241864e4",
      "InstanceId": "3c1c8fd7-4133-404a-82e9-93a015d85362",
      "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
      "MileageKm": 50.95000000000001,
      "MileageMile": 31.66033,
      "TripsCount": 9,
      "DriverTripsCount": 0,
      "OtherTripsCount": 9,
      "MaxSpeedKmh": 88.07221984863281,
      "MaxSpeedMileh": 54.728077413940426,
      "AverageSpeedKmh": 29.905130922862075,
      "AverageSpeedMileh": 18.58304835546649,
      "TotalSpeedingKm": 12.16,
      "TotalSpeedingMile": 7.556223999999999,
      "AccelerationCount": 1,
      "BreakingCount": 1,
      "CorneringCount": 1,
      "PhoneUsageDurationMin": 2.5,
      "PhoneUsageDistanceKm": 1.6570000000000003,
      "PhoneUsageDistanceMile": 1.0296598000000001,
      "PhoneUsageOverSpeedDurationMin": 0.05,
      "PhoneUsageOverSpeedDistanceKm": 0.047,
      "PhoneUsageOverSpeedDistanceMile": 0.029205799999999997,
      "DrivingTime": 82.20000000000002,
      "NightDrivingTime": 0,
      "DayDrivingTime": 21.583333373069763,
      "RushHoursDrivingTime": 75.533331990242
    }
  ,
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

## Individual User Daily Statistics

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/statistics/v1/Statistics/individual/daily/`

Get individual daily statistics for requested period\
\
**Authorization:** Required as User

#### Query Parameters

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| startDate | string | 2020-09-16  |
| endDate   | string | 2020-09-30  |

#### Headers

| Name          | Type   | Description                                                                  |
| ------------- | ------ | ---------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login> |

{% tabs %}
{% tab title="200 " %}

```
{
    "Result":
    {
        "DeviceToken": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "InstanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "AppId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "CompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "ReportDate": "2020-09-01T00:00:00",
        "MileageKm": 173.363,
        "MileageMile": 107.72776819999999,
        "TripsCount": 9,
        "DriverTripsCount": 0,
        "OtherTripsCount": 9,
        "MaxSpeedKmh": 96.83999633789062,
        "MaxSpeedMileh": 60.17637372436523,
        "AverageSpeedKmh": 41.62794511159958,
        "AverageSpeedMileh": 25.867605092347976,
        "TotalSpeedingKm": 3.5650000000000004,
        "TotalSpeedingMile": 2.215291,
        "AccelerationCount": 5,
        "BreakingCount": 10,
        "CorneringCount": 4,
        "PhoneUsageDurationMin": 5.383333333333334,
        "PhoneUsageDistanceKm": 0.651,
        "PhoneUsageDistanceMile": 0.4045314,
        "PhoneUsageOverSpeedDurationMin": 0.0,
        "PhoneUsageOverSpeedDistanceKm": 0.0,
        "PhoneUsageOverSpeedDistanceMile": 0.0,
        "DrivingTime": 332.41666666666663,
        "NightDrivingTime": 0.0,
        "DayDrivingTime": 195.83333539962769,
        "RushHoursDrivingTime": 142.55000114440918
    },
    "Status": 200,
    "Title": "",
    "Errors": []
}
```

{% endtab %}
{% endtabs %}

## Individual Latest Scoring and Track dates

## Individual Latest Scoring and Track dates

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/statistics/v1/Statistics/individual/latestDates`

**Authorization**: Required as User

#### Headers

| Name          | Type   | Description                                                                  |
| ------------- | ------ | ---------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login> |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result":
  {
    "DeviceToken": "58156858-3629-4931-89d9-0043e5873b91",
    "InstanceId": "5198e42d-3c0b-498e-9316-388fbc5f501d",
    "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
    "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
    "LastTrackDate": "2020-08-20T15:00:58.81", // +03:00
    "LastScoringDate": "2020-08-20T00:00:00"
  },
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}


# Admin | User(s) - Scorings and Statistics

Get all users' Statistics and Scorings within Company/Application/Group for period.

{% content-ref url="/pages/-MIwuMaFXm6EkQXbwQR1" %}
[Broken mention](broken://pages/-MIwuMaFXm6EkQXbwQR1)
{% endcontent-ref %}

{% hint style="warning" %}
Accumulated Scorings and Statistics — methods that allow to get Scorings and Statistics when **authorized as Admin** via [API Authorization Credentials](https://docs.telematicssdk.com/back-end-to-back-end-integration/authentication#api-authorization-credentials) only!

Please, read this doc carefully before start:
{% endhint %}

{% content-ref url="/pages/-M2cbbSRbIXaO9xQ9y0l" %}
[API Authorization](/user-statistics-and-analytics/authentication)
{% endcontent-ref %}

## Accumulated Scorings

{% hint style="info" %}
How the aggregated 14-day scoring is counted:
{% endhint %}

{% content-ref url="/pages/-Lw3KifDldQK4-RDAVqP" %}
[Risk driving Scoring](/product-description/scoring/riskdrivingscore)
{% endcontent-ref %}

{% content-ref url="/pages/-MJ83poNeSXHiuTT2XgN" %}
[Eco Scoring](/product-description/scoring/eco-scoring)
{% endcontent-ref %}

## Accumulated Scoring

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/statistics/v1/Scorings/accumulated`

Get all average individual scorings within Company/Application/Group for requested period.\
\
**Authorization:** Required as Admin

#### Query Parameters

| Name          | Type   | Description                                                      |
| ------------- | ------ | ---------------------------------------------------------------- |
| deviceToken   | string | One of these is required \| Individual User's DeviceToken (GUID) |
| CompanyID     | string | One of these is required                                         |
| ApplicationID | string | One of these is required                                         |
| InstanceID    | string | One of these is required                                         |
| startDate     | string | 2020-09-16                                                       |
| endDate       | string | 2020-09-30                                                       |
| tag           | string | consider only tagged trips (follow to SDK features => tags)      |

#### Headers

| Name          | Type   | Description                                                                  |
| ------------- | ------ | ---------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login> |

{% tabs %}
{% tab title="200 User has actual for today user scoring" %}

```
{
  "Result": [
    {
      "DeviceToken": "3fa85f64-5717-4562-b3fc-2c963f66afa3",
      "InstanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
      "AccelerationScore": 94.66666666666667,
      "BrakingScore": 78.66666666666667,
      "SpeedingScore": 40,
      "DistractedScore": 68.66666666666667,
      "CorneringScore": 100,
      "OverallScore": 69.66666666666667
    },
    {
      "DeviceToken": "3fa85f64-5717-4562-b3fc-2c963f66afa3",
      "InstanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
      "AccelerationScore": 95,
      "BrakingScore": 96,
      "SpeedingScore": 67.5,
      "DistractedScore": 72.5,
      "CorneringScore": 100,
      "OverallScore": 90.5
    },
    {
      "DeviceToken": "3fa85f64-5717-4562-b3fc-2c963f66afa3",
      "InstanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
      "AccelerationScore": 68.5,
      "BrakingScore": 76,
      "SpeedingScore": 66,
      "DistractedScore": 70,
      "CorneringScore": 87.5,
      "OverallScore": 82.5
    }
  ],
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

## Accumulated Daily Scoring

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/statistics/v1/Scorings/accumulated/daily`

Get all users' individual daily scorings within Company/Application/Group for requested period.\
\
**Authorization:** Required as Admin via API Authorization Credentials

#### Query Parameters

| Name          | Type   | Description                                                           |
| ------------- | ------ | --------------------------------------------------------------------- |
| deviceToken   | string | One of these is required \| Individual User's DeviceToken (GUID)      |
| CompanyID     | string | One of these is required                                              |
| ApplicationID | string | One of these is required                                              |
| InstanceID    | string | One of these is required                                              |
| startDate     | string | 2020-09-16                                                            |
| endDate       | string | 2020-09-30 \| Greater then StartDate and range less or equals 30 days |
| tag           | string | consider only tagged trips (follow to SDK features => Tags)           |

#### Headers

| Name          | Type   | Description                                                                  |
| ------------- | ------ | ---------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login> |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": [
    {
      "DeviceToken": "f70a2159-0827-4a4d-b620-4ff5cd0aa658",
      "InstanceId": "3c1c8fd7-4133-404a-82e9-93a015d85362",
      "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
      "AccelerationScore": 96,
      "BrakingScore": 80,
      "SpeedingScore": 40,
      "DistractedScore": 68,
      "CorneringScore": 100,
      "OverallScore": 70,
      "CalcDate": "2020-09-01T00:00:00"
    },
    {
      "DeviceToken": "f70a2159-0827-4a4d-b620-4ff5cd0aa658",
      "InstanceId": "3c1c8fd7-4133-404a-82e9-93a015d85362",
      "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
      "AccelerationScore": 94,
      "BrakingScore": 78,
      "SpeedingScore": 40,
      "DistractedScore": 69,
      "CorneringScore": 100,
      "OverallScore": 69,
      "CalcDate": "2020-09-02T00:00:00"
    },
    {
      "DeviceToken": "b3116105-f72c-460d-8b71-cd4269bf4c4a",
      "InstanceId": "3c1c8fd7-4133-404a-82e9-93a015d85362",
      "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
      "AccelerationScore": 96,
      "BrakingScore": 94,
      "SpeedingScore": 63,
      "DistractedScore": 71,
      "CorneringScore": 100,
      "OverallScore": 88,
      "CalcDate": "2020-09-02T00:00:00"
    },
    {
      "DeviceToken": "d71937a5-5f3a-4dc2-b449-e80d241864e4",
      "InstanceId": "3c1c8fd7-4133-404a-82e9-93a015d85362",
      "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
      "AccelerationScore": 67,
      "BrakingScore": 74,
      "SpeedingScore": 60,
      "DistractedScore": 67,
      "CorneringScore": 92,
      "OverallScore": 79,
      "CalcDate": "2020-09-02T00:00:00"
    }
  ],
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

## Accumulated Eco Scoring

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/statistics/v1/Scorings/accumulated/eco`

Get current accumulated users' eco scorings within Company/Application/Group\
\
**Authorization:** Required as Admin via API Authorization Credentials

#### Query Parameters

| Name          | Type   | Description                                                      |
| ------------- | ------ | ---------------------------------------------------------------- |
| deviceToken   | string | One of these is required \| Individual User's deviceToken (GUID) |
| CompanyID     | string | One of these is required                                         |
| ApplicationID | string | One of these is required                                         |
| InstanceID    | string | One of these is required                                         |

#### Headers

| Name          | Type   | Description                                                                   |
| ------------- | ------ | ----------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login>) |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": [
    {
      "DeviceToken": "4f51776b-3015-443d-a420-8a4379852855",
      "InstanceId": "3c1c8fd7-4133-404a-82e9-93a015d85362",
      "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
      "EcoScoringFuel": 99.15114,
      "EcoScoringTyres": 83.39971,
      "EcoScoringBrakes": 85.882416,
      "EcoScoringDepreciation": 99.0,
      "EcoScoring": 82.95479
    },
    {
      "DeviceToken": "2f2d99c1-ec03-4fd2-8029-fc16ab2969f3",
      "InstanceId": "3c1c8fd7-4133-404a-82e9-93a015d85362",
      "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
      "EcoScoringFuel": 99.15114,
      "EcoScoringTyres": 83.39971,
      "EcoScoringBrakes": 85.882416,
      "EcoScoringDepreciation": 99.0,
      "EcoScoring": 82.95479
    }
  ],
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

## Accumulated Users' Statistics

## Accumulated Users' Statistics

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/statistics/v1/Statistics/accumulated/`

**Authorization:** Required as Admin via API Authorization Credentials

#### Query Parameters

| Name          | Type   | Description                                                 |
| ------------- | ------ | ----------------------------------------------------------- |
| deviceToken   | string | One of these is required \| User's deviceToken (GUID)       |
| CompanyID     | string | One of these is required                                    |
| ApplicationID | string | One of these is required                                    |
| InstanceID    | string | One of these is required                                    |
| startDate     | string | 2020-09-16                                                  |
| endDate       | string | 2020-09-30                                                  |
| tag           | string | consider only tagged trips (follow to SDK features => tags) |

#### Headers

| Name          | Type   | Description                                                                  |
| ------------- | ------ | ---------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login> |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": [
    {
      "DeviceToken": "f70a2159-0827-4a4d-b620-4ff5cd0aa658",
      "InstanceId": "3c1c8fd7-4133-404a-82e9-93a015d85362",
      "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
      "MileageKm": 58.224000000000004,
      "MileageMile": 36.1803936,
      "TripsCount": 4,
      "DriverTripsCount": 0,
      "OtherTripsCount": 4,
      "MaxSpeedKmh": 115.69185638427734,
      "MaxSpeedMileh": 71.89091955718993,
      "AverageSpeedKmh": 45.88215183926666,
      "AverageSpeedMileh": 28.511169152920303,
      "TotalSpeedingKm": 11.219,
      "TotalSpeedingMile": 6.9714865999999995,
      "AccelerationCount": 2,
      "BreakingCount": 7,
      "CorneringCount": 0,
      "PhoneUsageDurationMin": 2.4166666666666665,
      "PhoneUsageDistanceKm": 1.393,
      "PhoneUsageDistanceMile": 0.8656102,
      "PhoneUsageOverSpeedDurationMin": 0,
      "PhoneUsageOverSpeedDistanceKm": 0,
      "PhoneUsageOverSpeedDistanceMile": 0,
      "DrivingTime": 95.75,
      "NightDrivingTime": 0,
      "DayDrivingTime": 84.9666690826416,
      "RushHoursDrivingTime": 16.75
    }
  ],
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

## Accumulated Daily Users' Statistics

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/statistics/v1/Statistics/accumulated/daily/`

**Authorization:** Required as Admin via API Authorization Credentials

#### Query Parameters

| Name          | Type   | Description              |
| ------------- | ------ | ------------------------ |
| startDate     | string | 2020-09-16               |
| endDate       | string | 2020-09-30               |
| deviceToken   | string | One of these is required |
| CompanyID     | string | One of these is required |
| ApplicationID | string | One of these is required |
| InstanceID    | string | One of these is required |

#### Headers

| Name          | Type   | Description                                                                   |
| ------------- | ------ | ----------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login/> |

{% tabs %}
{% tab title="200 " %}

```
{
    "Result": [
        {
            "DeviceToken": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "InstanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "AppId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "CompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "ReportDate": "2020-09-01T00:00:00",
            "MileageKm": 173.363,
            "MileageMile": 107.72776819999999,
            "TripsCount": 9,
            "DriverTripsCount": 0,
            "OtherTripsCount": 9,
            "MaxSpeedKmh": 96.83999633789062,
            "MaxSpeedMileh": 60.17637372436523,
            "AverageSpeedKmh": 41.62794511159958,
            "AverageSpeedMileh": 25.867605092347976,
            "TotalSpeedingKm": 3.5650000000000004,
            "TotalSpeedingMile": 2.215291,
            "AccelerationCount": 5,
            "BreakingCount": 10,
            "CorneringCount": 4,
            "PhoneUsageDurationMin": 5.383333333333334,
            "PhoneUsageDistanceKm": 0.651,
            "PhoneUsageDistanceMile": 0.4045314,
            "PhoneUsageOverSpeedDurationMin": 0.0,
            "PhoneUsageOverSpeedDistanceKm": 0.0,
            "PhoneUsageOverSpeedDistanceMile": 0.0,
            "DrivingTime": 332.41666666666663,
            "NightDrivingTime": 0.0,
            "DayDrivingTime": 195.83333539962769,
            "RushHoursDrivingTime": 142.55000114440918
        },
        {
            "DeviceToken": "3fa85f64-5717-4562-b3fc-2c963f66afa7",
            "InstanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "AppId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "CompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "ReportDate": "2020-09-01T00:00:00",
            "MileageKm": 83.251,
            "MileageMile": 51.7321714,
            "TripsCount": 11,
            "DriverTripsCount": 0,
            "OtherTripsCount": 11,
            "MaxSpeedKmh": 96.65534973144531,
            "MaxSpeedMileh": 60.06163432312011,
            "AverageSpeedKmh": 44.548493676012725,
            "AverageSpeedMileh": 27.682433970274307,
            "TotalSpeedingKm": 15.229,
            "TotalSpeedingMile": 9.463300599999998,
            "AccelerationCount": 0,
            "BreakingCount": 0,
            "CorneringCount": 0,
            "PhoneUsageDurationMin": 1.65,
            "PhoneUsageDistanceKm": 1.193,
            "PhoneUsageDistanceMile": 0.7413301999999999,
            "PhoneUsageOverSpeedDurationMin": 0.0,
            "PhoneUsageOverSpeedDistanceKm": 0.0,
            "PhoneUsageOverSpeedDistanceMile": 0.0,
            "DrivingTime": 122.23333333333332,
            "NightDrivingTime": 7.866666793823242,
            "DayDrivingTime": 124.99999856948853,
            "RushHoursDrivingTime": 14.350000381469727
        }
    ],
    "Status": 200,
    "Title": "",
    "Errors": []
}
```

{% endtab %}
{% endtabs %}

## Accumulated Latest Scoring and Track dates

## Accumulated Latest Scoring and Track dates

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/statistics/v1/Statistics/accumulated/latestDates`

**Authorization**: Required as Admin via API Authorization Credentials

#### Query Parameters

| Name          | Type   | Description                                           |
| ------------- | ------ | ----------------------------------------------------- |
| deviceToken   | string | One of these is required \| User's deviceToken (GUID) |
| CompanyID     | string | One of these is required                              |
| ApplicationID | string | One of these is required                              |
| InstanceID    | string | One of these is required                              |

#### Headers

| Name          | Type   | Description                                                                  |
| ------------- | ------ | ---------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login> |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": [
    {
      "DeviceToken": "58156858-3629-4931-89d9-0043e5873b91",
      "InstanceId": "5198e42d-3c0b-498e-9316-388fbc5f501d",
      "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
      "LastTrackDate": "2020-08-20T15:00:58.81", //+03:00
      "LastScoringDate": "2020-08-20T00:00:00"
    },
    {
      "DeviceToken": "58156858-2265-4931-89d9-0043e5873b91",
      "InstanceId": "5198e42d-3c0b-498e-9316-388fbc5f501d",
      "AppId": "3511c419-ea19-477d-bff0-980ec9dbb864",
      "CompanyId": "2fd6d2ef-7eb6-4beb-a40e-1f9b53f0e0be",
      "LastTrackDate": "2020-08-20T15:00:58.81", //+03:00
      "LastScoringDate": "2020-08-20T00:00:00"
    }
  ],
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}


# Admin | Consolidated Scorings and Statistics

Get a Company/Application/Group statistics and scorings for period.

{% content-ref url="/pages/-MIwuMaFXm6EkQXbwQR1" %}
[Broken mention](broken://pages/-MIwuMaFXm6EkQXbwQR1)
{% endcontent-ref %}

{% hint style="warning" %}
Consolidated Scorings and Statistics — methods that allow to get Scorings and Statistics when **authorized as Admin** via [API Authorization Credentials](https://docs.telematicssdk.com/back-end-to-back-end-integration/authentication#api-authorization-credentials) only!

Please, read this doc carefully before start:
{% endhint %}

{% content-ref url="/pages/-M2cbbSRbIXaO9xQ9y0l" %}
[API Authorization](/user-statistics-and-analytics/authentication)
{% endcontent-ref %}

## Consolidated Scorings

{% hint style="info" %}
How the aggregated 14-day scoring is counted:
{% endhint %}

{% content-ref url="/pages/-Lw3KifDldQK4-RDAVqP" %}
[Risk driving Scoring](/product-description/scoring/riskdrivingscore)
{% endcontent-ref %}

## Consolidated Scoring

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/statistics/v1/Scorings/consolidated/`

Get Company/App/Group average scorings for period\
\
**Authorization:** Required as Admin via API Authorization credentials

#### Query Parameters

| Name          | Type   | Description                                                 |
| ------------- | ------ | ----------------------------------------------------------- |
| startDate     | string | 2020-09-16                                                  |
| endDate       | string | 2020-09-30                                                  |
| deviceToken   | string | One of these is required \| GUID - user's deviceToken       |
| CompanyID     | string | One of these is required                                    |
| ApplicationID | string | One of these is required                                    |
| InstanceID    | string | One of these is required                                    |
| tag           | string | consider only tagged trips (follow to SDK features => tags) |

#### Headers

| Name          | Type   | Description                                                                                 |
| ------------- | ------ | ------------------------------------------------------------------------------------------- |
| Authorization | string | <p>"Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login><br><br></p> |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": {
    "DeviceToken": null,
    "InstanceId": null,
    "AppId": null,
    "CompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "AccelerationScore": 66.67073736280723,
    "BrakingScore": 69.54081001700418,
    "SpeedingScore": 91.83096305456795,
    "DistractedScore": 81.31542742309476,
    "CorneringScore": 85.3753284897202,
    "OverallScore": 84.23164322151801
  },
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

## Consolidated Daily Scoring

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/statistics/v1/Scorings/consolidated/daily`

Get Company/App/Group daily scorings for period\
\
**Authorization:** Required as Admin via API authorization credentials

#### Query Parameters

| Name          | Type   | Description                                                |
| ------------- | ------ | ---------------------------------------------------------- |
| startDate     | string | 2020-09-16                                                 |
| endDate       | string | 2020-09-30                                                 |
| deviceToken   | string | One of these is required                                   |
| CompanyID     | string | One of these is required                                   |
| ApplicationID | string | One of these is required                                   |
| InstanceID    | string | One of these is required                                   |
| tag           | string | consider only tagged trips (follow to SDK Feature => tags) |

#### Headers

| Name          | Type   | Description                                                                  |
| ------------- | ------ | ---------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login> |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": [
    {
      "DeviceToken": null,
      "InstanceId": null,
      "AppId": null,
      "CompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "AccelerationScore": 66.71781033153431,
      "BrakingScore": 69.6515034695451,
      "SpeedingScore": 91.87818041634542,
      "DistractedScore": 81.51195065535852,
      "CorneringScore": 85.46877409406322,
      "OverallScore": 84.25751734772552,
      "ReportDate": "2020-09-02T00:00:00"
    },
    {
      "DeviceToken": null,
      "InstanceId": null,
      "AppId": null,
      "CompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "AccelerationScore": 66.70100697134005,
      "BrakingScore": 69.56312935708753,
      "SpeedingScore": 91.83733539891557,
      "DistractedScore": 81.44848954298993,
      "CorneringScore": 85.30286599535243,
      "OverallScore": 84.15646785437646,
      "ReportDate": "2020-09-01T00:00:00"
    },
    {
      "DeviceToken": null,
      "InstanceId": null,
      "AppId": null,
      "CompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "AccelerationScore": 66.76086956521739,
      "BrakingScore": 69.43167701863354,
      "SpeedingScore": 91.8975155279503,
      "DistractedScore": 81.43711180124224,
      "CorneringScore": 85.4417701863354,
      "OverallScore": 84.17468944099379,
      "ReportDate": "2020-09-03T00:00:00"
    }
  ],
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

## Consolidated Users' Statistics

## Consolidated Users' Statistics

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/statistics/v1/Statistics/consolidated/`

Get Company/App/Group average statistics for period\
\
**Authorization:** Required as Admin via API Authorization Credentials

#### Query Parameters

| Name          | Type   | Description                                                 |
| ------------- | ------ | ----------------------------------------------------------- |
| startDate     | string | 2020-09-16                                                  |
| endDate       | string | 2020-09-30                                                  |
| deviceToken   | string | One of these is required                                    |
| CompanyID     | string | One of these is required                                    |
| ApplicationID | string | One of these is required                                    |
| InstanceID    | string | One of these is required                                    |
| tag           | string | Consider only tagged trips (follow to SDK Features => Tags) |

#### Headers

| Name          | Type   | Description                                                                  |
| ------------- | ------ | ---------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login> |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": {
    "DeviceToken": null,
    "InstanceId": null,
    "AppId": null,
    "CompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "TotalRegisteredUsers": 190,
    "ActiveUsers": 1313,
    "MileageKm": 537617.7080000002,
    "MileageMile": 334075.64375119965,
    "TripsCount": 45296,
    "DriverTripsCount": 0,
    "OtherTripsCount": 45296,
    "MaxSpeedKmh": 397713952,
    "MaxSpeedMileh": 247139449.77279997,
    "AverageSpeedKmh": 57.81757677554955,
    "AverageSpeedMileh": 35.92784220832652,
    "TotalSpeedingKm": 89678.98899999993,
    "TotalSpeedingMile": 55726.523764600104,
    "AccelerationCount": 19714,
    "BreakingCount": 33247,
    "CorneringCount": 14506,
    "PhoneUsageDurationMin": 20072.68333333334,
    "PhoneUsageDistanceKm": 14837.512000000017,
    "PhoneUsageDistanceMile": 9220.029956800094,
    "PhoneUsageOverSpeedDurationMin": 160.76666666666662,
    "PhoneUsageOverSpeedDistanceKm": 208.73200000000003,
    "PhoneUsageOverSpeedDistanceMile": 129.7060647999999,
    "DrivingTime": 829817.2833333338,
    "NightDrivingTime": 49086.56666017324,
    "DayDrivingTime": 540299.1333711203,
    "RushHoursDrivingTime": 279793.433260154
  },
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

## Consolidated Daily Users' Statistics

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/statistics/v1/Statistics/consolidated/daily/`

Get Company/App/Group daily statistics for period

#### Query Parameters

| Name          | Type   | Description                                                  |
| ------------- | ------ | ------------------------------------------------------------ |
| startDate     | string | 2020-09-16                                                   |
| endDate       | string | 2020-09-30                                                   |
| deviceToken   | string | One of these is required                                     |
| CompanyID     | string | One of these is required                                     |
| ApplicationID | string | One of these is required                                     |
| InstanceID    | string | One of these is required                                     |
| tag           | string | Consider only tagged tracks (Follow to SDK Features => tags) |

#### Headers

| Name          | Type   | Description                                                                  |
| ------------- | ------ | ---------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login> |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": [
    {
      "DeviceToken": null,
      "InstanceId": null,
      "AppId": null,
      "CompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "ReportDate": "2020-09-01T00:00:00",
      "TotalRegisteredUsers": 46,
      "ActiveUsers": 905,
      "MileageKm": 50653.07400000001,
      "MileageMile": 31475.820183600037,
      "TripsCount": 4341,
      "DriverTripsCount": 0,
      "OtherTripsCount": 4341,
      "MaxSpeedKmh": 216.9322509765625,
      "MaxSpeedMileh": 134.8017007568359,
      "AverageSpeedKmh": 44.83533361466009,
      "AverageSpeedMileh": 27.860676308149806,
      "TotalSpeedingKm": 7804.05500000001,
      "TotalSpeedingMile": 4849.439777000005,
      "AccelerationCount": 1880,
      "BreakingCount": 3045,
      "CorneringCount": 1314,
      "PhoneUsageDurationMin": 1851.566666666664,
      "PhoneUsageDistanceKm": 1328.7619999999986,
      "PhoneUsageDistanceMile": 825.6927067999976,
      "PhoneUsageOverSpeedDurationMin": 16.433333333333337,
      "PhoneUsageOverSpeedDistanceKm": 19.207999999999995,
      "PhoneUsageOverSpeedDistanceMile": 11.935851199999997,
      "DrivingTime": 78763.21666666667,
      "NightDrivingTime": 4070.6166611760855,
      "DayDrivingTime": 51999.18331839889,
      "RushHoursDrivingTime": 26545.38333223015
    },
    {
      "DeviceToken": null,
      "InstanceId": null,
      "AppId": null,
      "CompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "ReportDate": "2020-09-02T00:00:00",
      "TotalRegisteredUsers": 46,
      "ActiveUsers": 908,
      "MileageKm": 53735.65699999998,
      "MileageMile": 33391.33725980001,
      "TripsCount": 4503,
      "DriverTripsCount": 0,
      "OtherTripsCount": 4503,
      "MaxSpeedKmh": 233.43724060058594,
      "MaxSpeedMileh": 145.05790130920408,
      "AverageSpeedKmh": 44.997036431821094,
      "AverageSpeedMileh": 27.961158438733623,
      "TotalSpeedingKm": 9048.949999999993,
      "TotalSpeedingMile": 5623.0175300000255,
      "AccelerationCount": 1951,
      "BreakingCount": 3173,
      "CorneringCount": 1495,
      "PhoneUsageDurationMin": 1927.449999999997,
      "PhoneUsageDistanceKm": 1414.5970000000002,
      "PhoneUsageDistanceMile": 879.0305757999977,
      "PhoneUsageOverSpeedDurationMin": 15.816666666666672,
      "PhoneUsageOverSpeedDistanceKm": 16.258999999999997,
      "PhoneUsageOverSpeedDistanceMile": 10.1033426,
      "DrivingTime": 82229.74999999991,
      "NightDrivingTime": 4256.0333348587155,
      "DayDrivingTime": 53537.23337029666,
      "RushHoursDrivingTime": 28486.74998111278
    },
    {
      "DeviceToken": null,
      "InstanceId": null,
      "AppId": null,
      "CompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "ReportDate": "2020-09-03T00:00:00",
      "TotalRegisteredUsers": 46,
      "ActiveUsers": 917,
      "MileageKm": 52622.850000000064,
      "MileageMile": 32699.838990000066,
      "TripsCount": 4606,
      "DriverTripsCount": 0,
      "OtherTripsCount": 4606,
      "MaxSpeedKmh": 349.6319885253906,
      "MaxSpeedMileh": 217.2613176696777,
      "AverageSpeedKmh": 44.543960321550294,
      "AverageSpeedMileh": 27.679616943811364,
      "TotalSpeedingKm": 8844.20399999999,
      "TotalSpeedingMile": 5495.788365600025,
      "AccelerationCount": 1932,
      "BreakingCount": 3282,
      "CorneringCount": 1383,
      "PhoneUsageDurationMin": 2028.9833333333297,
      "PhoneUsageDistanceKm": 1488.9430000000004,
      "PhoneUsageDistanceMile": 925.2291801999974,
      "PhoneUsageOverSpeedDurationMin": 19.3,
      "PhoneUsageOverSpeedDistanceKm": 28.545999999999996,
      "PhoneUsageOverSpeedDistanceMile": 17.73848439999999,
      "DrivingTime": 82253.96666666663,
      "NightDrivingTime": 4572.133339047432,
      "DayDrivingTime": 52195.133328177035,
      "RushHoursDrivingTime": 29530.79998118058
    }
  ],
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}


# Trips API

URL: <https://mobilesdk.telematicssdk.com/mobilesdk/stage/>

Swagger: <https://mobilesdk.telematicssdk.com/mobilesdk/stage/swagger/ui/index#/Track>

{% content-ref url="/pages/-LtwYezyR4Dp9XjpyPHD" %}
[Get a list of tracks with paging](/user-statistics-and-analytics/processed-data/get_tracks)
{% endcontent-ref %}

{% content-ref url="/pages/-LtwYe\_mm5Zx0KCe09Fx" %}
[Get a single track with waypoints](/user-statistics-and-analytics/processed-data/get_track)
{% endcontent-ref %}

{% content-ref url="/pages/-MHMopWI5Va\_QHlMnERu" %}
[Get the most earliest track](/user-statistics-and-analytics/processed-data/get-the-most-earliest-track)
{% endcontent-ref %}

{% content-ref url="/pages/-MHMtFleniSMxJ2bY6O\_" %}
[Get a short list of tracks](/user-statistics-and-analytics/processed-data/get-a-short-list-of-tracks)
{% endcontent-ref %}

{% content-ref url="/pages/-MHMluBiA6d3rs4TOmsT" %}
[Track Statuses](/user-statistics-and-analytics/processed-data/track-statuses)
{% endcontent-ref %}


# Get a short list of tracks

Get all user tracks with trackTokens and update dates.

{% hint style="info" %}
All tracks in responses are sorted **descending**.
{% endhint %}

{% hint style="warning" %}
**"updateDate"** can be changed while processing a track by our platform.\
\
Our mobile SDK sends tracks to server, when recording is finished. It may record some part of a trip. It may send this part of the trip to server. Then it may detect movement again and start recording again.The second part will be sent to server later. SDK sends trips only when internet connection is stable. So, it can finish recording, save this part of trip in cache and send it for example only next day, when a good internet connection.\
\
If this happens, our platform merges this tracks into one and changes **updateDate** field value.
{% endhint %}

## Get all tracks

<mark style="color:blue;">`GET`</mark> `https://mobilesdk.telematicssdk.com/mobilesdk/stage/track/get_short_list/v1`

Returns all user tracks from very beginning\
\
**Authorization:** DeviceToken in Header

#### Headers

| Name        | Type   | Description        |
| ----------- | ------ | ------------------ |
| DeviceToken | string | DeviceToken (GUID) |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": {
    "ShortTrackList": [
      {
        "TrackToken": "2411ab6a-6482-4d8b-ab58-57096b930d39",
        "DateUpdated": "2018-09-13T23:00:03+03:00"
      },
      {
        "TrackToken": "19097c57-6420-4bbc-aee1-2cv70ce18aa0",
        "DateUpdated": "2018-06-29T17:20:32+03:00"
      }
      ...
    ],
    "Code": 200
  }
}
```

{% endtab %}
{% endtabs %}

## Get tracks by page

<mark style="color:blue;">`GET`</mark> `https://mobilesdk.telematicssdk.com/mobilesdk/stage/track/get_short_list_page/v1`

**Authorization:** DeviceToken in Header

#### Query Parameters

| Name  | Type   | Description               |
| ----- | ------ | ------------------------- |
| Page  | string | № of page                 |
| Count | string | Number of tracks per page |

#### Headers

| Name        | Type   | Description        |
| ----------- | ------ | ------------------ |
| DeviceToken | string | DeviceToken (GUID) |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": {
    "ShortTrackList": [
      {
        "TrackToken": "2411ab6a-6482-4d8b-ab58-57096b930d39",
        "DateUpdated": "2018-09-13T23:00:03+03:00"
      },
      {
        "TrackToken": "19097c57-6420-4bbc-aee1-2cv70ce18aa0",
        "DateUpdated": "2018-06-29T17:20:32+03:00"
      }
      ...
    ],
    "Code": 200
  }
}
```

{% endtab %}
{% endtabs %}

## Get tracks from specified date

<mark style="color:blue;">`GET`</mark> `https://mobilesdk.telematicssdk.com/mobilesdk/stage/track/get_short_list_from_date/v1`

**Authorization:** DeviceToken in Header

#### Query Parameters

| Name     | Type   | Description               |
| -------- | ------ | ------------------------- |
| fromDate | string | 2019-08-13T23:01:03+03:00 |

#### Headers

| Name        | Type   | Description        |
| ----------- | ------ | ------------------ |
| DeviceToken | string | DeviceToken (GUID) |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": {
    "ShortTrackList": [
      {
        "TrackToken": "2411ab6a-6482-4d8b-ab58-57096b930d39",
        "DateUpdated": "2018-09-13T23:00:03+03:00"
      },
      {
        "TrackToken": "19097c57-6420-4bbc-aee1-2cv70ce18aa0",
        "DateUpdated": "2018-06-29T17:20:32+03:00"
      }
      ...
    ],
    "Code": 200
  }
}
```

{% endtab %}
{% endtabs %}


# Get a list of tracks with paging

## Get Tracks

<mark style="color:blue;">`GET`</mark> `https://mobilesdk.telematicssdk.com/mobilesdk/stage/track/get_tracks/v1`

Get a list of tracks\
\
**Authorization:** DeviceToken in header

#### Query Parameters

| Name       | Type   | Description                                                                         |
| ---------- | ------ | ----------------------------------------------------------------------------------- |
| startDate  | string | Time filter. Format: 1990-01-01 by default. You can use "2019-09-10T12:37:49+02:00" |
| endDate    | string | Time filter. Format: 2019-09-10T12:37:49+02:00"                                     |
| lang       | string | "en" by default                                                                     |
| pageNumber | string | page number // 0 by default                                                         |
| pageSize   | string | tracks per page (0 = unlimited) // 0 by default                                     |

#### Headers

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| DeviceToken | string | DeviceToken |

{% tabs %}
{% tab title="200 " %}

```
{
   "Result": {
     "Tracks": [
         {
             "TrackToken": "d8ece0fc-de27-4c86-9c30-5a129a9725fc",
             "StartDate": "2018-06-14T14:53:07+04:00",
             "AddressStart": "N De Anza Blvd 10853, Cupertino, Santa Clara, United States",
             "EndDate": "2018-06-14T14:55:24+04:00",
             "AddressEnd": "Arboretum Dr 5893, Woodland Acres-the Highlands, Los Altos, Santa Clara, United States",
             "Status": "Active",
                "Distance": 0.728,
                "Duration": 3.3666666666666667,
                "AccelerationCount": 0,
                "DecelerationCount": 0,
                "Rating": 5.0,
                "RatingCornering": 5.0,
                "RatingAcceleration": 5.0,
                "RatingBraking": 5.0,
                "RatingSpeeding": 5.0,
                "RatingPhoneUsage": 5.0,
                "RatingTimeOfDay": 3.0,
                "PhoneUsage": 0.0,
                "MidOverSpeedMileage": 0.0,
                "HighOverSpeedMileage": 0.0,
                "TrackOriginCode": "OriginalDriver",
                "OriginChanged": false,
                "ShareType": "NotShared",
                "CityStart": "Podgorica",
                "CityFinish": "Podgorica",
                "Rating100": 100.0,
                "RatingCornering100": 100.0,
                "RatingAcceleration100": 100.0,
                "RatingBraking100": 100.0,
                "RatingSpeeding100": 100.0,
                "RatingPhoneDistraction100": 100.0,
                "AddressStartParts": {
                    "CountryCode": "USA",
                    "PostalCode": "81000",
                    "City": "Podgorica",
                    "District": "Podgorica",
                    "Street": "Ulica Vasa Raičkovića",
                    "House": "20"
                },
                "AddressFinishParts": {
                    "CountryCode": "USA",
                    "PostalCode": "81000",
                    "City": "New-York",
                    "District": "Podgorica",
                    "Street": "Ulica Svetlane Kane Radević",
                    "House": "1"
                },
        "Tags": [
          {
            "Name": "Sample Tag",
            "SourceType": "UserApp",
            "Source": "Sample application module name"
          },
                
         ...
      ],
      "Code": 200
   }
}
```

{% endtab %}
{% endtabs %}

## Fields Dictionary

| Field                                                                  | Description                                                                                                                                                                                                                                                                       |
| ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Status](/user-statistics-and-analytics/processed-data/track-statuses) | <p>Draft - received and processed track but without scoring yet</p><p>Active - processed track with scoring</p><p>Deleted - processed track which is not participating in user scoring count.</p><p>Can be changed by <a href="/pages/-MHMluBiA6d3rs4TOmsT">these</a> methods</p> |
| AccelerationCount                                                      | Number of accelerations per track                                                                                                                                                                                                                                                 |
| DecelerationCount                                                      | Number of brakes per track                                                                                                                                                                                                                                                        |
| MidOverSpeedMileage                                                    | Total mileage with overspeeding more than X km/h                                                                                                                                                                                                                                  |
| HighOverSpeedMileage                                                   | Total mileage with overspeeding more than X km/h                                                                                                                                                                                                                                  |
| TrackOriginCode                                                        | <p>OriginalDriver</p><p>Passanger<br>Bus<br>Train<br>Taxi<br>Bicycle<br>Motorcycle<br>Walking<br>Running<br>Other</p>                                                                                                                                                             |
| OriginChanged                                                          | If track origin was changed (false/true).                                                                                                                                                                                                                                         |


# Get a list of tracks by IDs

## List of tracks by IDs

<mark style="color:blue;">`GET`</mark> `https://mobilesdk.telematicssdk.com/mobilesdk/stage/track/get_t/tracks_with_address_by_ids/v1`

A**uthorization**: DeviceToken in Header

#### Headers

| Name        | Type   | Description              |
| ----------- | ------ | ------------------------ |
| DeviceToken | string | Users DeviceToken (GUID) |

{% tabs %}
{% tab title="200 " %}

```
{
    "Result": {
        "Tracks": [
            {
                "TrackToken": "baa456c2-1442-4432-bdbe-37f9baf2d701",
                "StartDate": "2020-09-19T15:30:06+02:00",
                "AddressStart": "Ulica Vuka Karadžića 5, Podgorica, Montenegro",
                "EndDate": "2020-09-19T15:50:16+02:00",
                "AddressEnd": "Medun, Podgorica, Montenegro",
                "Status": "Active",
                "Distance": 13.548,
                "Duration": 20.166666666666668,
                "AccelerationCount": 3,
                "DecelerationCount": 2,
                "Rating": 3.0,
                "RatingCornering": 2.0,
                "RatingAcceleration": 1.0,
                "RatingBraking": 2.0,
                "RatingSpeeding": 5.0,
                "RatingPhoneUsage": 5.0,
                "RatingTimeOfDay": 5.0,
                "PhoneUsage": 0.0,
                "MidOverSpeedMileage": 0.0,
                "HighOverSpeedMileage": 0.0,
                "TrackOriginCode": "Passanger",
                "OriginChanged": true,
                "ShareType": "NotShared",
            "CityStart": "Cupertino",
            "CityFinish": "Cupertino",
            "BeaconId": 0,
            "Rating100": 94.0,
            "RatingCornering100": 100.0,
            "RatingAcceleration100": 100.0,
            "RatingBraking100": 100.0,
            "RatingSpeeding100": 66.0,
            "RatingPhoneDistraction100": 100.0,
            "EcoScoreFuel": 100.0,
            "EcoScoreTyres": 100.0,
            "EcoScoreBrakes": 100.0,
            "EcoScoreDepreciation": 100.0,
            "EcoScore": 100.0,
                "AddressStartParts": {
                    "CountryCode": "MNE",
                    "PostalCode": "81000",
                    "City": "Podgorica",
                    "District": "Podgorica",
                    "Street": "Ulica Vuka Karadžića",
                    "House": "5"
                },
                "AddressFinishParts": {
                    "CountryCode": "MNE",
                    "PostalCode": "81205",
                    "City": "Podgorica",
                    "District": "Medun"
                }
            },
            {
                "TrackToken": "76c6e929-a2ne-462d-8bf1-e04c252523885",
                "StartDate": "2020-09-19T18:00:27+02:00",
                "AddressStart": "Medun, Medun, Podgorica, Montenegro",
                "EndDate": "2020-09-19T18:16:58+02:00",
                "AddressEnd": "Ulica Stanka Dragojevića 42, Podgorica, Montenegro",
                "Status": "Active",
                "Distance": 12.063,
                "Duration": 16.516666666666666,
                "AccelerationCount": 0,
                "DecelerationCount": 1,
                "Rating": 1.0,
                "RatingCornering": 1.0,
                "RatingAcceleration": 3.0,
                "RatingBraking": 3.0,
                "RatingSpeeding": 4.0,
                "RatingPhoneUsage": 1.0,
                "RatingTimeOfDay": 5.0,
                "PhoneUsage": 10.416666666666666,
                "MidOverSpeedMileage": 0.347,
                "HighOverSpeedMileage": 0.0,
                "TrackOriginCode": "Passanger",
                "OriginChanged": true,
                "ShareType": "NotShared",
            "CityStart": "Cupertino",
            "CityFinish": "Cupertino",
            "BeaconId": 0,
            "Rating100": 94.0,
            "RatingCornering100": 100.0,
            "RatingAcceleration100": 100.0,
            "RatingBraking100": 100.0,
            "RatingSpeeding100": 66.0,
            "RatingPhoneDistraction100": 100.0,
            "EcoScoreFuel": 100.0,
            "EcoScoreTyres": 100.0,
            "EcoScoreBrakes": 100.0,
            "EcoScoreDepreciation": 100.0,
            "EcoScore": 100.0,
                "AddressStartParts": {
                    "CountryCode": "MNE",
                    "PostalCode": "81205",
                    "City": "Podgorica",
                    "District": "Medun",
                    "Street": "Medun"
                },
                "AddressFinishParts": {
                    "CountryCode": "MNE",
                    "PostalCode": "81000",
                    "City": "Podgorica",
                    "District": "Podgorica",
                    "Street": "Ulica Stanka Dragojevića",
                    "House": "42"
                }
            }
        ],
        "Code": 200
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Body Request" %}

```
{
    "TrackTokens": [
"76c6e929-a2be-462d-8bf1-e04c2525b8d2",
"baa456c2-1442-4432-bdbe-37f9baf2d716"
...
]
}
```

{% endtab %}
{% endtabs %}

Fields dictionary is [here](https://docs.telematicssdk.com/back-end-to-back-end-integration/processed-data/get_tracks#fields-dictionary)


# Get a single track with waypoints

## Get Track

<mark style="color:blue;">`GET`</mark> `https://mobilesdk.telematicssdk.com/mobilesdk/stage/track/get_track/v1`

Get a single track with detailed data.\
\
**Authorization:** DeviceToken in Header

#### Query Parameters

| Name       | Type   | Description       |
| ---------- | ------ | ----------------- |
| trackToken | string | trackToken (GUID) |
| lang       | string | en by default     |

#### Headers

| Name        | Type   | Description        |
| ----------- | ------ | ------------------ |
| DeviceToken | string | DeviceToken (GUID) |

{% tabs %}
{% tab title="200 " %}

```
{
   "Result": {
     "Track": {
         "StartDate": "2018-06-14T14:53:07+04:00",
         "EndDate": "2018-06-14T14:55:24+04:00",
         "Distance": 3.882,
         "Duration": 2.2833333333333332,
         "AccelerationCount": 0,
         "DecelerationCount": 0,
         "AddressStart": "N De Anza Blvd 10853, Cupertino, Santa Clara, United States",
         "AddressEnd": "Arboretum Dr 5893, Woodland Acres-the Highlands, Los Altos, Santa Clara, United States",
         "Rating": 2,
         "RatingCornering": 0,
         "RatingAcceleration": 5,
         "RatingBraking": 5,
         "RatingSpeeding": 5,
         "RatingPhoneUsage": 5,
         "RatingTimeOfDay": 5,
         "PhoneUsage": 0,
         "MidOverSpeedMileage": 2.391,
         "HighOverSpeedMileage": 0,
         "OriginChanged": false,
         "TrackOriginCode": "OriginalDriver",
         "DrivingTips": "Why you have rating 40 on this trip:\r\n- Your speed was between 125 and 125 km/h while speed limit was 105 km/h from 14:53:57 to 14:53:57\r\n- Your speed was between 121 and 121 km/h while speed limit was 105 km/h from 14:54:21 to 14:54:21\r\n- Your speed was between 121 and 124 km/h while speed limit was 105 km/h from 14:54:39 to 14:55:15",
         "Points": [
             {
                 "Id": 694549523,
                 "Number": 14,
                 "TotalMeters": 3.7097899999999995,
                 "Speed": 7.3079996109008789,
                 "MidSpeed": 0,
                 "PointDate": "2018-06-14T14:53:07+04:00",
                 "Latitude": 37.33527,
                 "Longitude": -122.03246,
                 "Height": 0,
                 "Course": 0,
                 "Yaw": 0,
                 "Lateral": 0,
                 "AlertType": "",
                 "AlertValue": 0,
                 "SpeedType": "norm",
                 "SpeedLimit": 999,
                 "PhoneUsage": false
             },
             ...
         ],
            "ShareType": "NotShared",
            "CityStart": "Cupertino",
            "CityFinish": "Cupertino",
            "BeaconId": 0,
            "Rating100": 94.0,
            "RatingCornering100": 100.0,
            "RatingAcceleration100": 100.0,
            "RatingBraking100": 100.0,
            "RatingSpeeding100": 66.0,
            "RatingPhoneDistraction100": 100.0,
            "EcoScoreFuel": 100.0,
            "EcoScoreTyres": 100.0,
            "EcoScoreBrakes": 100.0,
            "EcoScoreDepreciation": 100.0,
            "EcoScore": 100.0,
            "AddressStartParts": {
             "CountryCode": "USA",
             "Country": "United States",
             "County": "SANTA CLARA",
             "PostalCode": "95015",
             "State": "CA [California]",
             "City": "Cupertino",
             "District": "CA",
             "Street": "North De Anza Boulevard ",
             "House": "10853"
         },
         "AddressFinishParts": {
             "CountryCode": "USA",
             "Country": "United States",
             "County": "SANTA CLARA",
             "PostalCode": "94024",
             "State": "Central Federal District",
             "City": "Woodland Acres-the Highlands, Los Altos",
             "District": "CA",
             "Street": "Arboretum Dr",
             "House": "5380"
         }
      }
      "Code": 200
   }
}
```

{% endtab %}
{% endtabs %}

## Fields Dictionary

| Field       | Description                                                   |
| ----------- | ------------------------------------------------------------- |
| ID          | Point ID                                                      |
| Number      | Serial number of point in track                               |
| TotalMeters | Distance since start of track enriched, meters                |
| Speed       | Speed in point (km/h)                                         |
| MidSpeed    | Average speed since previous point (km/h)                     |
| Point time  | Point time                                                    |
| Latitude    | Latitude (enriched, float)                                    |
| Longitude   | Longitude (enriched, float)                                   |
| Height      | Height from GPS (sea level, cm)                               |
| Course      | Course from GPS (direction of movement in degrees)            |
| Yaw         | Yaw from GPS (horizontal rotation in degrees)                 |
| Lateral     | Lateral acceleration                                          |
| AlertType   | ‘acc’, ‘deacc’ (acceleration and deceleration events)         |
| AlertValue  | AlertValue for specific alert type in m/s2                    |
| SpeedType   | SpeedType (‘norm’, 'mid', 'high') (default settings 0-10-20+) |
| SpeedLimit  | SpeedLimit for points and direction in km/h                   |
| PhoneUsage  | binary (1- Phone is used, 0- Phone is not used)               |
| Cornering   | for cornering events                                          |


# Get the most earliest track

This method allows you to know the date of the earliest track to use it in "Get a list of tracks" or "get a short list of tracks" methods, for example.

## Get the most earliest track

<mark style="color:blue;">`GET`</mark> `https://mobilesdk.telematicssdk.com/mobilesdk/stage/track/get_earliest_track/v1`

**Authorization:** DeviceToken in Header

#### Headers

| Name        | Type   | Description        |
| ----------- | ------ | ------------------ |
| DeviceToken | string | DeviceToken (GUID) |

{% tabs %}
{% tab title="200 " %}

```
{
    "Result": {
        "Track": {
            "StartDate": "2020-02-20T10:46:11+08:00",
            "EndDate": "2020-02-20T11:01:47+08:00",
            "Status": "Deleted",
            "Distance": 6.298,
            "Duration": 15.6,
            "AccelerationCount": 0,
            "DecelerationCount": 2,
            "AddressStart": "-8.52362, 115.27420",
            "AddressEnd": "-8.51035, 115.26453",
            "Rating": 4.0,
            "RatingCornering": 5.0,
            "RatingAcceleration": 5.0,
            "RatingBraking": 2.0,
            "RatingSpeeding": 5.0,
            "RatingPhoneUsage": 5.0,
            "RatingTimeOfDay": 3.2521436214447021,
            "PhoneUsage": 0.0,
            "MidOverSpeedMileage": 0.0,
            "HighOverSpeedMileage": 0.0,
            "OriginChanged": false,
            "TrackOriginCode": "OriginalDriver",
            "ShareType": "NotShared",
            "CityStart": "Gianyar",
            "CityFinish": "Gianyar",
            "Rating100": 83.0,
            "RatingCornering100": 100.0,
            "RatingAcceleration100": 100.0,
            "RatingBraking100": 43.0,
            "RatingSpeeding100": 100.0,
            "RatingPhoneDistraction100": 100.0,
            "EcoScoreFuel": 93.0,
            "EcoScoreTyres": 100.0,
            "EcoScoreBrakes": 100.0,
            "EcoScoreDepreciation": 25.0,
            "EcoScore": 73.0
        },
        "Code": 200
    }
}
```

{% endtab %}

{% tab title="404 " %}

```
{
    "Result": {
        "Code": 404,
        "Message": "No tracks found for Device token"
    }
}
```

{% endtab %}
{% endtabs %}

Fields dictionary is [here](https://docs.telematicssdk.com/back-end-to-back-end-integration/processed-data/get_tracks#fields-dictionary)


# Track Statuses

## Statuses

| Status  | Description                                                                                                 |
| ------- | ----------------------------------------------------------------------------------------------------------- |
| Draft   | received and processed track but without risk & eco scores yet                                              |
| Active  | processed track which is participating in user's risk & eco scores calculation                              |
| Deleted | processed track which is **not** participating in user's risk & eco scores calculation                      |
| Hidden  | processed track which is participating in user's risk & eco scores calculation but can be not shown to user |

## Get track status dictionary

<mark style="color:blue;">`GET`</mark> `https://mobilesdk.telematicssdk.com/mobilesdk/stage/track/statuses/v1/get`

**Authorization:** DeviceToken in Header

#### Headers

| Name        | Type   | Description        |
| ----------- | ------ | ------------------ |
| DeviceToken | string | DeviceToken (GUID) |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": {
    "Statuses": [
      {
        "DisplayName": "Unknown",
        "Code": "Unknown"
      },
      {
        "DisplayName": "Draft",
        "Code": "Draft"
      },
      {
        "DisplayName": "Active",
        "Code": "Active"
      },
      {
        "DisplayName": "Deleted",
        "Code": "Deleted"
      },
      {
        "DisplayName": "Hidden",
        "Code": "Hidden"
      }
    ],
    "Code": 200
  }
}
```

{% endtab %}
{% endtabs %}

## Set Active Status

<mark style="color:green;">`POST`</mark> `https://mobilesdk.telematicssdk.com/mobilesdk/stage/track/{trackToken}/setactive/v1`

**Authorization:** DeviceToken in Header

#### Headers

| Name        | Type   | Description                                   |
| ----------- | ------ | --------------------------------------------- |
| DeviceToken | string | DeviceToken (GUID), which recorded this track |

{% tabs %}
{% tab title="200 " %}

```
{
    "Result": {
        "Code": 200
    }
}
```

{% endtab %}
{% endtabs %}

## Set Deleted Status

<mark style="color:green;">`POST`</mark> `https://mobilesdk.telematicssdk.com/mobilesdk/stage/track/{trackToken}/setdeleted/v1`

**Authorization:** DeviceToken in Header

#### Headers

| Name        | Type   | Description                                   |
| ----------- | ------ | --------------------------------------------- |
| DeviceToken | string | DeviceToken (GUID), which recorded this track |

{% tabs %}
{% tab title="200 " %}

```
{
    "Result": {
        "Code": 200
    }
}
```

{% endtab %}
{% endtabs %}

## Set Hidden Status

<mark style="color:green;">`POST`</mark> `https://mobilesdk.telematicssdk.com/mobilesdk/stage/track/{trackToken}/sethidden/v1`

**Authorization:** DeviceToken in Header

#### Headers

| Name        | Type   | Description                                   |
| ----------- | ------ | --------------------------------------------- |
| DeviceToken | string | DeviceToken (GUID), which recorded this track |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}


# \*Bluetooth Device - Get started

Documentations on connecting Bluetooth OBD (ELM device) in order to collect data from vehicle CAN port.

{% content-ref url="/pages/-MN2O6i1OyXnEtPoOi4F" %}
[\*Get Started](/sdk-features/bluetooth-obd/get-started)
{% endcontent-ref %}

{% content-ref url="/pages/-MBDfDg9ytAWiTapeVrt" %}
[\*iOS - ELM API](/sdk-features/bluetooth-obd/elm-api)
{% endcontent-ref %}


# \*Get Started

**Swagger:**  <https://services.telematicssdk.com/api/carservice/swagger/index.html>

## Dataset:

{% content-ref url="/pages/-MRyrHw1W41avY-uG5QA" %}
[Bluetooth OBD - Vehicle Dataset](/product-description/dataset/dataset-decription/bluetooth-obd)
{% endcontent-ref %}

## Required steps:

| # | Step                                      | Chapter         | Resource                                                                                                                                                                                                                                                                                                                                           |
| - | ----------------------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1 | Create a user (if it doesn't exist)       | User service    | <https://docs.telematicssdk.com/platform-features/back-end-as-a-service>                                                                                                                                                                                                                                                                           |
| 2 | Create a vehicle and link with user/users | Vehicle service | <https://docs.telematicssdk.com/platform-features/back-end-as-a-service/car-service>                                                                                                                                                                                                                                                               |
| 3 | Connect Bluetooth OBD                     | OBD connection  | <p>iOS: <a href="https://docs.telematicssdk.com/sdk-features/bluetooth-obd/elm-api"><https://docs.telematicssdk.com/sdk-features/bluetooth-obd/elm-api></a></p><p>Android: <a href="https://docs.telematicssdk.com/sdk-features/bluetooth-obd/android-elm-api"><https://docs.telematicssdk.com/sdk-features/bluetooth-obd/android-elm-api></a></p> |

### The overall scheme of dependencies

![](/files/-MUV94_VWs638r4-i2dw)


# \*Android - ELM API

## Getting Started

First of all you should enable working with ELM feature on initialization step:

{% code title="Your Application class" %}

```kotlin
**
* Default Setting constructor
* Stop tracking time is 5 minute.
* Parking radius is 100 meters.
* Auto start tracking is true.
* hfOn - true if HIGH FREQUENCY data recording from sensors (acc, gyro) is ON and false otherwise.
* isElmOn - true <- to enable ELM  
*/
val settings = Settings(Settings.stopTrackingTimeHigh, Settings.accuracyHigh, true, true, true)

TrackingApi.getInstance().initialize(this, settings)
```

{% endcode %}

## Bluetooth Low Energy (BLE)

Feature will not work if smartphone doesn't support **Bluetooth Low Energy**.

First of all check it by this way:

```kotlin
if (!packageManager.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
   // inform user about his device doesn't support BLE
 }
```

If smartphone supports BLE you should turn it ON:

```kotlin
// get Bluetooth adapter and check is it enabled or not
val mBluetoothAdapter = BluetoothUtils.getBluetoothAdapter(this)
mBluetoothAdapter?.let {
    if (!mBluetoothAdapter.isEnabled) {
        // ask user to enable Bluetooth if it's off
        val intent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)
        startActivityForResult(intent, Constants.REQUEST_BLUETOOTH_ENABLE_CODE)
    } else {
        // Bluetooth is enabled already
    }
}

...

// handle result of Bluetooth enable
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    if (requestCode == Constants.REQUEST_BLUETOOTH_ENABLE_CODE && resultCode == Activity.RESULT_OK) {
            // Bluetooth successfully enabled
    } else {
        // user didn't enabled Bluetooth
    }
    super.onActivityResult(requestCode, resultCode, data)
}
    
```

## Register a callback

If smartphone supports BLE and it's turned on you can scan ELM-devices and connect to it .

All interaction with ELM-devices are realised inside `VehicleElmManager` . You can get it by:

```kotlin
TrackingApi.getInstance().getElmManager()
```

To receive a callbacks from `VehicleElmManager` you should register a `ElmLinkingListener` .

It has 4 methods inside:

* `onScanningComplete` - method will be called after successfull devices searching. It has a list of founded devices inside.
* `onScanningFailed` - method will be called if error occures when scanning BLE-devices. Method has inside an error that you can handle like in example below.
* `onLinkingComplete` - method will be called when smartphone was successfully paired with ELM-device. Returnes token of the vehicle and ELM-device Mac-address string.
* `onLinkingFailed` - method will be called if some error occures during connection process.&#x20;

  Method has inside an error that you can handle like in example below.

```kotlin

// initialize callback
val elmLinkingLister = object : ElmLinkingListener {
		override fun onScanningComplete(foundDevices: List<ElmDevice>) {
			// choose your device from foundedDevices list
		}

		override fun onScanningFailed(error: ElmLinkingError) {
			// error occurred during the scanning
			when (error) {
				ElmLinkingError.SERVER_ERROR_NETWORK_CONNECTION_NOT_AVAILABLE-> {
					// network error, check your connection and try again
				}
				ElmLinkingError.SERVER_ERROR_UNKNOWN -> {
					// error on server side, try again or contact the support
				}
				else -> {
					// unknown error, try again
				}
			}
		}

		override fun onLinkingFailed(error: ElmLinkingError) {
			// error occurred when device was pairing with smartphone
			when (error) {
				ElmLinkingError.SERVER_ERROR_NETWORK_CONNECTION_NOT_AVAILABLE-> {
					// network error, check your connection and try again
				}
				ElmLinkingError.SERVER_ERROR_UNKNOWN -> {
					// error on server side, try again or contact the support
				}
				ElmLinkingError.VEHICLE_NOT_SUPPORTED -> {
					// not supported vehicle
				}
				else -> {
					// unknown error, try again
				}
			}
		}

		override fun onLinkingComplete(vehicleToken: String, elmMAC: String) {
			// elm device was successfully paired with vehicle.
		}
	}
```

After that you should register it:

```kotlin
TrackingApi.getInstance().getElmManager()?.registerLinkingListener(elmLinkingLister)
```

**Important!** Dont forget to unregister a callback when it isn't needed to avoid memory leaks:

```kotlin
TrackingApi.getInstance().getElmManager()?.unregisterLinkingListener()
```

## Scan devices

After successfully registering a callback to `VehicleElmManager` you can start a devices scanning:

```
TrackingApi.getInstance().getElmManager()?.getElmDevices()
```

`getElmDevices` method will scan Bluetooth devices and submit them to `onScanningComplete` method . After that you should choose your ELM-device from the list. If something went wrong error will be submitted to `onScanningFailed` method of the callback.

## Connect to ELM device

For further work you should have registered vehicle(-s) on your account. More information about managing vehicles you can find [here](/platform-features/car-service).

First of all you should get list of the registered vehicles:

```kotlin
TrackingApi.getInstance().getElmManager()?.getVehicles()
```

{% hint style="danger" %}
You should call this method on a separate thread. \
Otherwise `android.os.NetworkOnMainThreadException`will be thrown
{% endhint %}

It will return an array of registered vehicles (`Array<RegisteredVehicle>`).

Choose you vehicle from the list and connect it to ELM-device (that you found on scanning step):

```kotlin
TrackingApi.getInstance().getElmManager()?.connectAndRegisterDevice(device.deviceMacAddress!!, selectedCar.token)
```

You should pass to `connectAndRegisterDevice` method two parameters:

1. ELM-device mac-Address (`String`)
2. Car token (`String`)

Method will pair Bluetooth device with your car and submit the result to `onLinkingComplete` method of the callback. If something went wrong error will be submitted to `onLinkingFailed` method of the callback.

## Get information about session

You can get info about session:

```kotlin
TrackingApi.getInstance().getElmManager()?.getLastSession()?.let { info: Pair<Boolean, Long> ->
   // handle result
}
```

It has inside a `Pair<Boolean, Long>` where:

* fisrt - `Boolean` flag about is ELM-connected
* second - `Long` is a UNIX-timestamp when ELM device was connected

**Happy coding!**


# \*iOS - ELM API

**Add a key to Info.plist file of your app with a description of the requirement why they need Bluetooth:**\
\
Privacy - Bluetooth Peripheral Usage Description

**In xCode, in the Signing & Capabilities project section, add the following items:**\
\
Uses Bluetooth LE accesories\
Acts as a Bluetooth LE accessory

**When initialisingRaxelPulse SDK library, be sure to call:**\
\
\[\[RPCPermissionsWizard returnInstance] setupBluetoothEnabled];\
\[RPEntry enableELM: YES];

#### Search ELM Devices

```
[[RPELMEntry instance] getELMDevicesWithCompletion:^(id  _Nullable response, NSArray * _Nullable errors) {
    for(RPELMItem *item in response) {
        NSLog(@"item.tag = %@ item.uuid = %@", item.name, item.uuid);
    }
}];
```

#### Get Vehicles

```
[[RPELMEntry instance] getVehicles:^(id  _Nullable response, NSArray * _Nullable errors) {
    NSLog(@"%@",response);
}];
```

#### Connect ELM with Vehicle

```
[[RPELMEntry instance] connectDevice:@"92D29DC3-48C0-D6A6-3700-4264BEEB4762" vehicleToken:@"28e4f4ea-b495-40ec-875b-17b48c39bc07" withCompletion:^(BOOL response, NSArray * _Nullable errors) {
    if (response) {
        // Success
    } else {
        for error in errors {
            NSLog(@"error - %@", [error localizedDescription])
    }
}];
```

When connecting to ELM, you may experience difficulties getting a repetitive response in the \[RPELMEntry instance] connectDevice method.\
We recommend doing DispatchQueue.once (token: "com.\<YOURAPPNAME>.elm"). The example code is shown below.

```
RPELMEntry.instance().connectDevice(@"92D29DC3-48C0-D6A6-3700-4264BEEB4762", vehicleToken: ct!, withCompletion: {[weak self] response, errors in
    guard let strongSelf = self else {
        return
    }
    
    if let theErrors = errors as? [NSError] {
        var isNetwork = false
        for item in theErrors {
            if item.code == 2005 {
                isNetwork = true
                break;
            }
        }
        if isNetwork {
            //Internet connection error
        }
        
        DispatchQueue.main.async {
                    
            if response == true {
                print("\(response)")
            } else {
                print("\(response)")

                DispatchQueue.once(token: "com.<YOURAPPNAME>.elm") {
                    //Next connection action
                }
            }
    })
```

```
public extension DispatchQueue {
    
    private static var _onceTracker = [String]()
    
    class func once(token: String, block:()->Void) {
        objc_sync_enter(self); defer { objc_sync_exit(self) }
        
        if _onceTracker.contains(token) {
            return
        }
        
        _onceTracker.append(token)
        block()
    }
}
```

At any time you can request the status of the connection to ELM (connected/not connected) and the timestamp date of the last connection.

```
let isConnect = RPELMEntry.instance().getLastSession().isConnect
let lastConnect = RPELMEntry.instance().getLastSession().lastConnect
```


# Trip Tags - Get started

TAG feature allows you to add a tag to a trip, combine several trips into one tag, or extract a part of a trip in order to get statistics by tags

There are 2 type of TAGs:

* **Trip TAG** - it can be applied to any recorded trips. there is no time limitation so that you can do it for old trips as well.
* **Period TAG** - it can be applied for a period of time, starting from now. This tag can be applied for the past periods.

## Use cases

**Trip TAG** - a transportation company wants to get a statistics on how its drivers drive a car for different ride-hailing companies. to do that, you have to tag trips and then get a statistics by tags

![Example of data set with applied TAGs](/files/-M2ODngvYRP5oD3Rd1Dv)

There is no restrictions on a number of TAGs per trip as well as TAG's name

**Period TAG - to combine several trips under a single TAG** - A logistic company that specializes in intercity deliveries want to get statistics by orders. So, when this company gets an order to deliver goods from Sydney to Melbourne it can take several days that means several trips. To get statistics by the order they combine several trips under one TAG by activating tag when driver accepts his job/picks up goods, and deactivating TAG when the driver completes his job.

![Example of grouping several trips under a single tag](/files/-M2OPmVvU0pC07vMFEsz)

**Period TAG - to extract a part of trip** - an insurance company has pay per minute insurance. customer can activate and deactivate insurance at any time. Price for the insurance depends on driving behaviours and time of being insured in previous month. They use a policy number as a tag name and activate and deactivate every time when customer turns on and off insurance.

.

![Example of extracting a part of trip](/files/-M2OTQkGXdrz_YIQE9iD)

{% hint style="success" %}
Tag can be activated and deactivated whether via SDK or API call
{% endhint %}

###

###


# Tags for trips via mobile app

{% content-ref url="/pages/-M3BVYcaJ-exxNFCsv-T" %}
[Android - Tags for trips](/sdk-features/tags/trip-tag/android-enriched-tags-for-individual-trips)
{% endcontent-ref %}

{% content-ref url="/pages/-M3BVbhAAqDSMaqUca-n" %}
[iOS - Tags for trips](/sdk-features/tags/trip-tag/ios-enriched-tags-for-individual-trips)
{% endcontent-ref %}


# Android - Tags for trips

```kotlin
/**
 * Returns track tags.
 *
 * @param trackId  Track id.
 * @throws IllegalStateException if [initialize] never called. See also [isInitialized].
 */
fun getTrackTags(trackId: String): Array<TrackTag>

/**
 * Add track tags. Return tags successfully added (with tag and type only, without source).
 *
 * @param trackId  Track id.
 * @throws IllegalStateException if [initialize] never called. See also [isInitialized].
 */ 
fun addTrackTags(trackId: String, tags: Array<TrackTag>): Array<TrackTag>

/**
 * Remove track tags. Return tags successfully removed (with tag and type only, without source).
 *
 * @param trackId  Track id.
 * @throws IllegalStateException if [initialize] never called. See also [isInitialized].
 */
fun removeTrackTags(trackId: String, tags: Array<TrackTag>): Array<TrackTag>
```

```kotlin
package com.raxeltelematics.v2.sdk.server.model.sdk

class TrackTag(
	/**
	 * Tag name.
	 */
	var tag: String,
	/**
	 * Source. For ex. App module (optional)
	 */
	var source: String? = null
) {

	/**
	 * Source type. Maybe: "Sdk", "UserApp".
	 * ONLY internal set. Readonly for public
	 */
	var type: String? = null
		internal set(value) {
			field = value
		}
}
```


# iOS - Tags for trips

```
/**
 * Returns track tags.
 *
 * @param trackToken  Track id.
 */
- (void)getTrackTags:(NSString *)trackToken completion:(id response, NSArray *error)callback;

/**
 * Add track tags. Return tags successfully added (with tag and type only, without source).
 *
 * @param trackToken  Track id.
 */ 
- (void)addTrackTags:(NSArray<RPTag *>*)tags to:(NSString *)trackToken completion:(id response, NSArray *error)callback;

/**
 * Remove track tags. Return tags successfully removed (with tag and type only, without source).
 *
 * @param trackToken  Track id.
 */
- (void)removeTrackTags:(NSArray<RPTag *>*)tags from:(NSString *)trackToken completion:(id response, NSArray *error)callback;
```


# Tags for period

### ACTIVATE TAG

Method is used for activation of tag. All new trips that will be received from a virtual device, will be marked with this tag until its deactivation.

\
**URL:** <https://mobilesdk.telematicssdk.com/mobilesdk/incoming/tags/activate\\>
**HTTP METHOD**: POST\
**HEADERS:**\
DeviceToken: 194df5b4-5322-43f5-bea7-16d85debfd00\
**REQUEST BODY:**\
***Tag:*** tag name. String. All symbols and spaces allowed. Value is required.\
***Type:*** type of tag. Now only “SDK” and “UserApp” are supported. Value is required.\
***Source:*** ID of tag activation source. String. Optional value.\
***ActivationTime:*** ISO 8601 with time-zone. Optional value. If empty, the server value will be used.

\
**Example request body**

```
{
    "Tag": "Sample Tag 1",
    "Type": "SDK",
    "Source": "",
    "ActivationTime": "2019-11-22T14:19:36+03:00"
}
```

**RESPONSE:**\
Success

```
{
    "Result": {
        "Code": 200
    }
}
```

Error

```
{
    "Error": {
        "Code": 400
    }
}
```

<br>

NOTE: If you try to activate the previously activated tag, the error will be returned. Activation of already active tag is not allowed.

### DEACTIVATE TAG

Method is used for deactivation of tag, that is used for marking the trips received from a virtual device.

\
**URL:** <https://mobilesdk.telematicssdk.com/mobilesdk/incoming/tags/deactivate\\>
**HTTP METHOD**: POST\
**HEADERS:**\
DeviceToken: 194df5b4-5322-43f5-bea7-16d85debfd00\
**REQUEST BODY:**\
***Tag:*** tag name. String. All symbols and spaces allowed. Value is required.\
***Type:*** type of tag. Now only “SDK” and “UserApp” are supported. Value is required.\
***Source:*** ID of tag activation source. String. Optional value.\
***DeactivationTime:*** ISO 8601 with time-zone. Optional value. If empty, the server value will be used.

**Example request body**

```
{
    "Tag": "Sample Tag 1",
    "Type": "SDK",
    "Source": "",
    "DeactivationTime": "2019-11-22T14:19:36+03:00"
}
```

**RESPONSE:**\
Success

```
{
    "Result": {
        "Code": 200
    }
}
```

\
&#x20;Error

```
{
    "Error": {
        "Code": 400
    }
}
```

NOTE: If you try to deactivate the non-active tag, the error will be returned.

### GET ACTIVE TAGS

Method will be used for receiving the list of active tags on the specified date.

\
**URL:** <https://mobilesdk.telematicssdk.com/mobilesdk/incoming/tags/get/{utc\\_unixtimestamp}\\>
**HTTP METHOD**: GET\
**HEADERS:**\
DeviceToken: 194df5b4-5322-43f5-bea7-16d85debfd00\
**REQUEST:**\
{utc\_unixtimestamp} - UTC in UNIX timestamp, when a moment of active tags. Optional. If not specified - the current time will be used. Example: 1574424517<br>

**RESPONSE:**\
&#x20;Success

```
{
  "Result": {
    [
      {
        "Tag": "Sample tag 1",
        "Type": "SDK",
        "Source": "",
        "ActivationTime": "2019-11-22T14:19:36+03:00",
        "IsServerActivationTime": true
      },
      {
        "Tag": "Sample tag 2",
        "Type": "SDK",
        "Source": "",
        "ActivationTime": "2019-11-21T12:15:00-04:00",
        "IsServerActivationTime": false
      }
    ],
    "Code": 200
  }
```

***Tag:*** tag name. String. All symbols and spaces allowed. Value is required.\
***Type:*** type of tag. Now only “SDK” and “UserApp” are supported. Value is required.\
***Source:*** ID of tag activation source. String. Optional value.\
***ActivationTime:*** ISO 8601 with time-zone. Optional value. If empty, the server name will be used.\
***IsServerActivationTime:*** logic value. True - if the server value was used. False - if the user value was used.<br>

\
&#x20;Error

```
{
    "Error": {
        "Code": 400
    }
}
```


# \*User Management

{% content-ref url="/pages/-M2cbbSRbIXaO9xQ9y0l" %}
[API Authorization](/user-statistics-and-analytics/authentication)
{% endcontent-ref %}

{% content-ref url="/pages/-M2dDwZqUaGL5jm\_d4hA" %}
[\*User Registration](/platform-features/back-end-as-a-service/registration)
{% endcontent-ref %}

{% content-ref url="/pages/-MGDw8R\_-HGoLKlf2Swx" %}
[\*Check User Existence](/platform-features/back-end-as-a-service/check-user-existence)
{% endcontent-ref %}

{% content-ref url="/pages/-M2dS\_mqn8nYnKdLFmUq" %}
[\*User Management](/platform-features/back-end-as-a-service/management)
{% endcontent-ref %}


# \*User Registration

Register DeviceToken

Please make sure you have **InstanceID** and **InstanceKey** (of the user group where you want to register a new user) ready. If no, please refer to the part of [account registration ](/acc_reg)

{% content-ref url="/pages/-LuUmX-1A1Kf56uZIEPl" %}
[Broken mention](broken://pages/-LuUmX-1A1Kf56uZIEPl)
{% endcontent-ref %}

## Telematics parameters

{% hint style="info" %}
User service enables managing user's telematics parameters. It can be set up during registration or changed later via  [**Update User**](/platform-features/back-end-as-a-service) method.
{% endhint %}

| Parameter              | Description                                                                                                                                                                         |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| "EnableTracking"       | Activate/Deactivate SDK tracking                                                                                                                                                    |
| EnableLogging          | Activate/Deactivate debug mode (**IMPORTANT:** this option causes a greater battery consumption. Use it carefully only while debugging!)                                            |
| EnableRealtimeLocation | Activate/Deactivate online location monitoring                                                                                                                                      |
| Enabled                | Activate/Deactivate user (Note: deactivated user is not a deleted user. If you need to permanently delete user, use [Delete User](/platform-features/back-end-as-a-service) method) |

## Register a new user

<mark style="color:green;">`POST`</mark> `http://user.telematicssdk.com /v1/Registration/Create`

Register a new user. The method returns DeviceToken that will be placed to telematics SDK and will play a role of an identifier to link telematics data with app user.\
\
**Authorization:** Allow anonymous

#### Headers

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| InstanceID  | string | //required  |
| InstanceKey | string | //required  |

{% tabs %}
{% tab title="200 Success" %}

```
{
  "Result": {
    "DeviceToken": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "AccessToken": {
      "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MmU4M2U2ZS00YmQxLTQzNTMtYThjMS02ZGY2YzJhMzJhM2QiLCJqdGkiOiJlZWEwMjlmMS01MGY1LTQyYTMtYTNiOS0zMTgyMGI3YjkxZjIiLCJpYXQiOjE1NzY0MDAzNTcsIkFwcGxpY2F0aW9uSWQiOiIxMDAyIiwiU2RrRW5hYmxlTG9nZ2luZyI6IkZhbHNlIiwiU2RrRW5hYmxlVHJhY2tpbmciOiJUcnVlIiwiU2RrRW5hYmxlUmVhbFRpbWVMb2NhdGlvbiI6IkZhbHNlIiwiU2RrQ2xpZW50SWQiOiIiLCJJbnN0YW5jZUlkIjoiM2MxYzhmZDctNDEzMy00MDRhLTgyZTktOTNhMDE1ZDg1MzYyIiwiSW5zdGFuY2VLZXkiOiIxYjdjYzI1Zi0zMjllLTQ0ODItOWRkMS0wYmIwN2MwYzc5NGIiLCJEZXZpY2VUb2tlbiI6IjUyZTgzZTZlLTRiZDEtNDM1My1hOGMxLTZkZjZjMmEzMmEzZCIsIkNvbXBhbnlJZCI6IjMiLCJSZWZyZXNoVG9rZW5FeHBpcmVkRGF0ZSI6IjIyLjEyLjIwMTkgODo1OTowOSIsIlJlZnJlc2hUb2tlbiI6InhacnN0MjF1SjN6cGw1Mmgybi9wUXM3eUVsYTZ6ZmthcDFWT2hnYUhOUVE9IiwibmJmIjoxNTc2NDAwMzU3LCJleHAiOjE1NzY0MDc1NTcsImlzcyI6IndlYkFwaSIsImF1ZCI6Imh0dHA6Ly9sb2NhbGhvc3Q6NTEzNzQvIn0.5z6eRrKUvI5d0hkjgrOcjPSpCRPsj12uKPkTvKBZ4hI",
      "ExpiresIn": 7200
    },
    "RefreshToken": "xZrst21uJ3zpl52h2n/pQs7yEla6zfkap1VOhgaHNQQ="
  },
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
For transition period we are using Device Token, however it will be replaced with JWT token soon.&#x20;

For the purpose of smooth transition, we recommend you to store JWT token and refresh token together with Device ID. Once we will be ready to move to JWT Token we will inform our clients respectively. Device Token will be supported over 12 month since announcement.

JWT token has a lifetime. After this period - it expires. When your JWT token is expired you should refresh your token.

We will support the old platform till November 01, 2021 and keep inform all our clients about progress and required steps.
{% endhint %}

{% hint style="info" %}
Important: JWT Token will be used in other API Requests.
{% endhint %}

Optionally you can add user information to User Service as well as manage SDK tracking and data collection

{% hint style="success" %}
Adding user information unlocks better experience working with DataHub. The more information you share, the more completed profile you will get in DataHub, as well as more data for portfolio categorisation.
{% endhint %}

{% hint style="success" %}
In case if added UBI Platform as a product you have to add either phone number of email as a login and generate a password. You can create password for your users and send it via sms or email. Currently the system supports 2 types of login: phone number -> password is sent via sms; email -> password will be emailed.
{% endhint %}

{% tabs %}
{% tab title="Request Body" %}

```
{   
  "CreateAccessToken": true,  // default = true, - return jwt token in response for immediately using or use login to receive jwt
  "FirstName": "string",
  "LastName": "string",
  "Nickname": "string",
  "Phone": "string",
  "Email": "string",
  "Gender": "None", // { "None", "Male", "Female", "Other" }
  "Birthday": "2019-12-13T06:19:18.837Z",
  "MaritalStatus": "string",
  "ChildrenCount": 0,
  "Country": "string",
  "District": "string",
  "City": "string",
  "Address": "string",
  "ImageUrl": "string" // photo url (you can upload your photo later),
  "InstanceInviteCode": "string", // Registration in instance by invite code
  "UserFields": { // default = null. Will be using dafult values below
    "EnableTracking": true, // default = true - enable tracking user motion
    "EnableLogging": false; // default = false - enable logging on mobile device
    "Enabled": true, // default = true - enable telematics SDK
    "ClientId": "string", // default = null. User ID in your system
  }
}
```

{% endtab %}
{% endtabs %}

## Register multiple users

<mark style="color:green;">`POST`</mark> `/v1/Registration/CreateMany`

Create a bulk of users\
\
**Authorization:** Allow anonymous

#### Path Parameters

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| InstanceID  | string | //required  |
| InstanceKey | string | //required  |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": {
    "Results": [
      {
        "DeviceToken": "8eedd2d1-e873-4cf4-a641-21f478c9c7a3",
         "AccessToken": {
          "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MmU4M2U2ZS00YmQxLTQzNTMtYThjMS02ZGY2YzJhMzJhM2QiLCJqdGkiOiJlZWEwMjlmMS01MGY1LTQyYTMtYTNiOS0zMTgyMGI3YjkxZjIiLCJpYXQiOjE1NzY0MDAzNTcsIkFwcGxpY2F0aW9uSWQiOiIxMDAyIiwiU2RrRW5hYmxlTG9nZ2luZyI6IkZhbHNlIiwiU2RrRW5hYmxlVHJhY2tpbmciOiJUcnVlIiwiU2RrRW5hYmxlUmVhbFRpbWVMb2NhdGlvbiI6IkZhbHNlIiwiU2RrQ2xpZW50SWQiOiIiLCJJbnN0YW5jZUlkIjoiM2MxYzhmZDctNDEzMy00MDRhLTgyZTktOTNhMDE1ZDg1MzYyIiwiSW5zdGFuY2VLZXkiOiIxYjdjYzI1Zi0zMjllLTQ0ODItOWRkMS0wYmIwN2MwYzc5NGIiLCJEZXZpY2VUb2tlbiI6IjUyZTgzZTZlLTRiZDEtNDM1My1hOGMxLTZkZjZjMmEzMmEzZCIsIkNvbXBhbnlJZCI6IjMiLCJSZWZyZXNoVG9rZW5FeHBpcmVkRGF0ZSI6IjIyLjEyLjIwMTkgODo1OTowOSIsIlJlZnJlc2hUb2tlbiI6InhacnN0MjF1SjN6cGw1Mmgybi9wUXM3eUVsYTZ6ZmthcDFWT2hnYUhOUVE9IiwibmJmIjoxNTc2NDAwMzU3LCJleHAiOjE1NzY0MDc1NTcsImlzcyI6IndlYkFwaSIsImF1ZCI6Imh0dHA6Ly9sb2NhbGhvc3Q6NTEzNzQvIn0.5z6eRrKUvI5d0hkjgrOcjPSpCRPsj12uKPkTvKBZ4hI",
          "ExpiresIn": 7200
        },
        "RefreshToken": "otCqu3EL9FSdml9jKhzq4G+hrD6AxZcgo6pUjI1mhqQ="
      },
      {
        "DeviceToken": "72466e2b-a99d-4311-92cb-d977a1eb36ea",
        "AccessToken": {
          "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MmU4M2U2ZS00YmQxLTQzNTMtYThjMS02ZGY2YzJhMzJhM2QiLCJqdGkiOiJlZWEwMjlmMS01MGY1LTQyYTMtYTNiOS0zMTgyMGI3YjkxZjIiLCJpYXQiOjE1NzY0MDAzNTcsIkFwcGxpY2F0aW9uSWQiOiIxMDAyIiwiU2RrRW5hYmxlTG9nZ2luZyI6IkZhbHNlIiwiU2RrRW5hYmxlVHJhY2tpbmciOiJUcnVlIiwiU2RrRW5hYmxlUmVhbFRpbWVMb2NhdGlvbiI6IkZhbHNlIiwiU2RrQ2xpZW50SWQiOiIiLCJJbnN0YW5jZUlkIjoiM2MxYzhmZDctNDEzMy00MDRhLTgyZTktOTNhMDE1ZDg1MzYyIiwiSW5zdGFuY2VLZXkiOiIxYjdjYzI1Zi0zMjllLTQ0ODItOWRkMS0wYmIwN2MwYzc5NGIiLCJEZXZpY2VUb2tlbiI6IjUyZTgzZTZlLTRiZDEtNDM1My1hOGMxLTZkZjZjMmEzMmEzZCIsIkNvbXBhbnlJZCI6IjMiLCJSZWZyZXNoVG9rZW5FeHBpcmVkRGF0ZSI6IjIyLjEyLjIwMTkgODo1OTowOSIsIlJlZnJlc2hUb2tlbiI6InhacnN0MjF1SjN6cGw1Mmgybi9wUXM3eUVsYTZ6ZmthcDFWT2hnYUhOUVE9IiwibmJmIjoxNTc2NDAwMzU3LCJleHAiOjE1NzY0MDc1NTcsImlzcyI6IndlYkFwaSIsImF1ZCI6Imh0dHA6Ly9sb2NhbGhvc3Q6NTEzNzQvIn0.5z6eRrKUvI5d0hkjgrOcjPSpCRPsj12uKPkTvKBZ4hI",
          "ExpiresIn": 7200
        },
        "RefreshToken": "lPHZM7PrtiFPdtGn9bhS4H5z8sFRQtmSAD6td6QkXbg="
      }
    ]
  },
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Request Body" %}

```
{
  "Quantity": 0,  // required
  "CreateAccessToken": true, // default = true
  "CustomFields": {
    "EnableTracking": true, // default = true
    "EnableLogging": false; // default = false
    "Enabled": true, // default = true
  }  
}
```

{% endtab %}
{% endtabs %}

## Refresh Token

{% hint style="info" %}
For any actions use JWT token. You can get it after registration (if GenerateAccessToken = true), Authorization and after RefreshToken.<br>

**Using:** got 401 Error => refresh token => new JWT and refresh token.\
Refresh token changes when Login and RefreshToken.
{% endhint %}

## Refresh Token

<mark style="color:green;">`POST`</mark> `https://user.telematicssdk.com/v1/RefreshToken`

**Authorization:** Allow Anonymous

#### Request Body

| Name         | Type   | Description                                                     |
| ------------ | ------ | --------------------------------------------------------------- |
| AccessToken  | string | The AccessToken that should be refreshed                        |
| RefreshToken | string | RefreshToken recieved with AccessToken that should be refreshed |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": {
    "DeviceToken": "string",
    "AccessToken": {
      "Token": "jwt token",
      "ExpiresIn": 7200
    },
    "RefreshToken": "new refresh token"
  },
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

### Format of Body Request:

```
{
  "AccessToken": "string", // required - JWT
  "RefreshToken": "string" // required
}
```


# \*Check User Existence

Find any user by parameters and confirm his existence

## UserExists

<mark style="color:blue;">`GET`</mark> `https://user.telematicssdk.com/v1/Check/UserExists`

**Authorization:** Allow Anonymous

#### Query Parameters

| Name     | Type   | Description              |
| -------- | ------ | ------------------------ |
| Phone    | string | Phone number of the user |
| Email    | string | Email of the user        |
| ClientID | string | ClientID of the user     |

#### Headers

| Name      | Type   | Description                         |
| --------- | ------ | ----------------------------------- |
| InsanceID | string | Instance where to look for the user |

{% tabs %}
{% tab title="200 " %}

```
{
  "Result": {
    "UserExists": true, // true or false
    "FirstName": "string",
    "LastName": "string",
    "Nickname": "string",
    "ImageUrl": "string"
  },
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}




---

[Next Page](/llms-full.txt/1)

