> For the complete documentation index, see [llms.txt](https://docs.mobguards.com/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mobguards.com/en/android-usage/android-installation.md).

# Installation

The BotProtection Android SDK is required to collect data from the device and transfer it to the server.

For implementation, an AAR file for Android will be provided, which will contain an SDK for collecting user behavioral data from the device’s sensors.

## Android Studio integration

An example of embedding a library in “Android Studio” IDE:

* Download AAR file.
* Go to `File > Project Structure`.

![File > Project Structure](https://682550200-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LxuA45qGEyH69CNfgF8%2F-LzC7fvnVZtWr1isv5Vy%2F-LzC8rUU_7VJja0SxlWR%2Fimage.png?alt=media\&token=8a019137-acb1-4781-958e-deae1d8a0a28)

* Select `Modules`, then click `+` above your app name.

![](https://682550200-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LxuA45qGEyH69CNfgF8%2F-LzC7fvnVZtWr1isv5Vy%2F-LzCK-ybX-f9jF9Zvbdq%2Fimage.png?alt=media\&token=499d45c9-8e71-4936-9084-a798a256d080)

* Select `Import .JAR/.AAR Package`.

![](https://682550200-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LxuA45qGEyH69CNfgF8%2F-LzC7fvnVZtWr1isv5Vy%2F-LzCKGqD0klfMnTN8na2%2Fimage.png?alt=media\&token=f5111ddd-6d32-4a34-ae2b-9f9d64bc13c8)

* The path to the AAR library should be added to the `File name`.

![](https://682550200-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LxuA45qGEyH69CNfgF8%2F-LzM8svPdXs0Psjp8H3R%2F-LzM9kJ4WWw973Mf-KPo%2Funtitled%20\(3\).png?alt=media\&token=b48f8f19-283c-47d1-a8c8-2728a82546a2)

* Click `Finish`.
* In `Project Structure` click `Apply` and wait for synchronisation. Then you'll be able to see `botprotection` under your Modules:

![](https://682550200-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LxuA45qGEyH69CNfgF8%2F-LzCKwNsrI2mfPwawvZr%2F-LzCL5vuuqELWCK7F_xi%2Fimage.png?alt=media\&token=bf17cd6e-e6bc-461a-98fc-c85f2bc0f869)

* Go to `Dependencies` and click `+` under `Declared Dependencies`.

![](https://682550200-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LxuA45qGEyH69CNfgF8%2F-LzCKwNsrI2mfPwawvZr%2F-LzCLlbrl_yBE9S59wSu%2Fimage.png?alt=media\&token=8c97fc6f-6246-4dfb-866d-ebc2c9105119)

* Select `Module Dependencies`.

![](https://682550200-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LxuA45qGEyH69CNfgF8%2F-LzCKwNsrI2mfPwawvZr%2F-LzCLsrearE2F3HKFlBq%2Fimage.png?alt=media\&token=f9d0126a-5d93-40d5-b4db-15836bda2485)

* Check the box for the added library and click `OK`.

![](https://682550200-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LxuA45qGEyH69CNfgF8%2F-LzCKwNsrI2mfPwawvZr%2F-LzCLz81U6Ef8oWgjeeL%2Fimage.png?alt=media\&token=592cafcf-82a5-4e2f-a802-4a82132af1fd)

* In the `Project Structure`, click `Apply`, wait for the synchronisation to pass.
* Check that the BotProtection library has been added to `build.gradle` of the main application module.

![](https://682550200-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LxuA45qGEyH69CNfgF8%2F-LzCKwNsrI2mfPwawvZr%2F-LzCMkz5PqZcEX_hq1mB%2Funtitled.png?alt=media\&token=22d81629-744a-4370-aa90-19d37e59baec)

## Alternative Integration

However, if KTS is used or it is not possible to add a module, then the alternative is to add a library via `build.gradle` (after adding the AAR file to the libs directory inside an application module):

```java
implementation files('libs/BotProtection*.aar')
```

## BotProtection API\_KEY

Next, you need to paste the resulting KEY API into `AndroidManifest.xml`:

```markup
 <application>
 //...
 
 <meta-data android:name="com.botProtection.ApiKey" 
            android:value="<api_key>" />
 
 //...
 </application>
```
