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.

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

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

Add the following dependency

    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

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:

<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)

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.

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.

import com.geouniq.android.GeoUniq;

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.


Last updated