Create a New Project

Last updated:

You begin by creating an initial application. Throughout this tutorial, you will modify and extend that starter application to create a simple application which covers the basic features of this guide.

Set Up Your Environment

This guide explains how to start using a MapsIndoors map in your Android application using the MapsIndoors Android SDK v3.

We recommend using Android Studio for using this tutorial. Read how to set it up here: Installing Android Studio

If you do not have a Android device, you can setup an emulator through Android Studio. You can see how to do that here: Setting up Android emulator.

If you already have an Android device, make sure to enable developer mode and USB debugging. Read about this here: Enable USB debugging

To benefit from the guides, you will need basic knowledge about:

  • Android Development
  • Google Maps Android API

You can get started in two ways, either by reviewing and modifying the basic example or do the clean setup. We recommend following the basic example.

Basic Example

The tutorial will be based on you starting from our basic map implementation. This contains basic UI implementations together with layout files and drawables used to create the UI. You will then be guided through how to implement the MapsIndoors SDK into this app.

The basic example contains a single activity app with already made fragments to host the different logic to get a complete app interacting with a map and MapsIndoors data.

You can find this basic example here: Java or Kotlin

You can open the project through Android Studio by navigating through File -> New -> Project from Version Control -> GitHub. Log in and clone the project.

You can also follow the steps below to start your app from scratch or to enhance the Basic Examples, more features will be explained in later guides.

Setup MapsIndoors

If you don't already have a project, we recommend using the Google Maps Activity preset from Android Studio to getting started on developing your MapsIndoors project. You find the Google Maps Activity project through File -> New -> New Project... -> Google Maps Activity.

Add the MapsIndoors SDK as a dependency to your project. The AAR for the MapsIndoors SDK contains both Java classes, SDK resources and an AndroidManifest.xml template which gets merged into your application's AndroidManifest.xml during build process.

Add or merge in the following to your app's build gradle file (usually called build.gradle).

Make sure that the minimum Android SDK version is 21 (aka. "Android Lollipop", version 5.0) or above:

android {
defaultConfig {
minSdkVersion 21
}
...
}

MapsIndoors relies on Java 8 features, so you must add the following compile options, also in android section of your build.gradle file:

android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

Add the following dependencies and the MapsIndoors maven repository:

Gson and okhttp is used by MapsIndoors to function properly with network calls and deserializing.

play-services-maps is used for Google Maps which MapsIndoors is build on top of on Android.

dependencies {
...
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.mapspeople.mapsindoors:mapsindoorssdk:3.9.2'
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
}
repositories{
maven {
url 'http://maven.mapsindoors.com/'
}
}

Put those lines in your proguard-rules files:

-keep interface com.mapsindoors.mapssdk.** { *; }
-keep class com.mapsindoors.mapssdk.errors.** { *; }
-keepclassmembers class com.mapsindoors.mapssdk.models.** { <fields>; }
-keep class com.mapsindoors.mapssdk.dbglog

Sync your project with gradle.

Next up: Show a map