Getting started - Android

Basic steps to start using Woosmap Geofencing SDK for Android
  1. Installation
    1. Gradle Config
    2. AndroidManifest.xml Configuration
  2. Initialization
  3. Tracking
  4. Connect your application to the Firebase service

Installation

The easiest way to use Woosmap Geofencing SDK in your Android project to add our maven’s repository in Gradle.

Gradle Config

Add our Maven repository in the build.gradle of the project

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://wgs-android-maven.s3-eu-west-1.amazonaws.com"
        }
    }
}

Then import our package in the build.gralde of the application

dependencies {
    implementation 'com.webgeoservices:woosmap-mobile-sdk:0.3.1'
}

AndroidManifest.xml Configuration

Create, if it’s not already done, a Woosmap Geofencing SDK Private key through the Woosmap Console. Woosmap Create a Private Key

And set up the private key newly created inside your the <application> block of your AndroidManifest.xml file.

<meta-data android:name="woosmap_private_key" android:value="Your_Woosmap_Private_key"/>

Initialization

Import Woosmap Geofencing SDK package in your Application class.

import com.webgeoservices.woosmap_mobile_sdk.Woosmap;

Initialize Woosmap Geofencing SDK from onCreate callback of your Application class as shown below.

public Woosmap woosmap;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.woosmap = Woosmap.getInstance().initializeWoosmap(this);
}  

Tracking

You'll need to request permission from user and set user tracking to true or false from permission request callback depending on whether permission is granted or not. Check next topic to see how.

Woosmap Geofencing SDK automatically starts tracking user data by calling woosmap.updateUserTracking(true). Data are stored on the device in a local database and synced when the network connectivity is available.

Please, follow steps described in the Location Tracking section to complete the Woosmap Geofencing SDK integration in your Android app.

Connect your application to the Firebase service

A Firebase connexion is required by Woosmap’s library and is used to receive and display notifications.

To connect your application to Firebase follow this tutorial

If you see the following error:

Make sure to call FirebaseApp.initializeApp(Context) first 

It means that your application is not correctly connected to your Firebase project.