# Quickstart

{% hint style="warning" %}
The Android SDKs lower than **3.1.0** uses version 19.0.1 of the play-services-location library and it is not compatible with versions higher than 20.0.x.\
If you need to manually import this library, make sure it's one of the compatible versions.
{% endhint %}

### Gradle Configuration

Open the file build.gradle file of the application module (not the main project) on Android Studio. Add the following lines to import geouniq url repository

```java
android {
    //...
	repositories {
	    maven { url "https://mymavenrepo.com/repo/PzY5Lw6PNZ938XDfVtzf/" }
    }
}
```

Add the following dependency

```java
dependencies{
    implementation 'com.geouniq.android:c4w-location-sdk:x.y.z'
}
```

> Replace x.y.z with a specific version of library that you can find [here](https://mymavenrepo.com/repo/PzY5Lw6PNZ938XDfVtzf/com/geouniq/android/c4w-location-sdk/)

### Manifest Configuration

The library already declare the basic permissions that needs, if your app meets the Google Play Store policies for background location, make sure you've declared permission to access background location:

```xml
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
```

### ProGuard Configuration

The library already contains its ProGuard configuration file, which will be merged with your application's during the build process.

### Providing the Mobile Key

The Mobile Key generated for your app when you configured your project (see here) must be provided as a string resource with name `"geouniq_mobile_key"`.

This can be done by putting the following line into the Gradle build script of your app (*build.gradle* file of your app module)

```java
defaultConfig {
    //...
    it.resValue("string", "geouniq_mobile_key", "YOUR_MOBILE_KEY")
}
```

It could be convenient to set a different value for the debug and the relase build types.

> Note that the certificates used for the two build types are generally different, and thus their SHA1 fingerprint will be different. For this reason, you should create two different Client Apps, one for the debug and one for the release build, each with its own fingerprint (see Project Configuration). A common solution is to create two different projects, one for test and one for production, and create an Android Client App on each project, using the debug fingerprint for the test project and the release fingerprint for the production project.

```java
buildTypes {
    release {
        //...
        it.resValue("string", "geouniq_mobile_key", "YOUR_PRODUCTION_MOBILE_KEY")
    }
    debug {
        //...
        it.resValue("string", "geouniq_mobile_key", "YOUR_TEST_MOBILE_KEY")
    }
}
```

### Initialize SDK

Before initializing the SDK, the below must be imported.

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

```java
import com.geouniq.android.GeoUniq;
```

{% endtab %}
{% endtabs %}

After import, add the below code under the Application class `onCreate()` method. The SDK must be enabled before calling any of the other SDK methods.

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

```kotlin
GeoUniq.getInstance(context).enable()
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

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

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

```
GET https://create.cloud4wi.ai/dev-hub/location-sdk/integrating-the-sdk/android/quickstart.md?ask=<question>
```

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

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