Android SDK

Setup the Woosmap Geofencing SDK using Android SDK

  1. Install SDK
  2. Dependencies
  3. Initialize SDK

The Woosmap Geofencing SDK allows you to monitor Geofences, track your user’s location and connect with the Woosmap Search and Distance APIs.

Learn how to integrate the Android SDK below. You can also explore a part of the source code on GitHub to get deeper into how user location is collected.

Find the release notes for the Geofencing Android SDK here.

Install SDK

You can install the SDK using Gradle. Note that the SDK is small and adds 400 KB to your compiled app. Geofencing SDK along with it’s dependencies adds an overhead of around 4 MB to the compiled APK.

Gradle via Maven central

Add the Maven central repository to your build.gradle file at the end of repositories, and add the dependency as follows:

        dependencies {
    implementation 'com.webgeoservices.woosmapgeofencing:woosmap-mobile-sdk:+'



The SDK requires Android 9 or newer, Google Play Services Location, and the open source Java library used for matrix and equations calculations.

The SDK currently supports API level 28 and higher.

Initialize SDK

To retrieve your user’s location data when your app starts, initialize the SDK in MainActivity through the onCreate() method.

        import com.webgeoservices.woosmapgeofencing.Woosmap;
import com.webgeoservices.woosmapgeofencing.WoosmapSettings;
import com.webgeoservices.woosmapgeofencingcore.database.*;

public class MainActivity extends AppCompatActivity {
    private Woosmap woosmap;
    protected void onCreate(Bundle savedInstanceState) {
        this.woosmap = Woosmap.getInstance().initializeWoosmap(this);
        this.woosmap.setLocationReadyListener(new WoosLocationReadyListener());    


Then, create a Listener connect to the interface Woosmap.LocationReadyListener and set a callback to retrieve user current location.

        public class WoosLocationReadyListener implements Woosmap.LocationReadyListener {
    public void LocationReadyCallback(Location location) {
private void onLocationCallback(Location currentLocation) {
    //Work with the user Location here


To get location consistently, call woosmap.onResume() and woosmap.onPause() functions on corresponding method of the App Activity Lifecycle.

public void onResume() {
    if (checkPermissions()) {    //Permission to get Location OK
    } else {                     //Not alowed so Ask to Share Location

public void onPause(){
    if (checkPermissions()) {
        this.woosmap.onPause(); //Get Location In Background

Was this article helpful?
Have more questions? Submit a request