NAOMAPSDK is a mobile map tool that allows developers to integrate indoor maps into Android and iOS applications using map data from NAO Cloud. This SDK simplifies the process of adding indoor mapping functionality to mobile apps, making it easier for developers to create location-based applications that leverage indoor maps provided by NAO Cloud .
Functionalities and Features
Indoor Maps Integration: NAOMAPSDK allows mobile applications to incorporate indoor maps seamlessly. These maps are typically sourced from NAOcloud
Display of NAOcloud Geofences: The SDK provides the capability to display geofences defined in NAOcloud within the mobile application. These geofences are rendered with the same colors as defined in NAOcloud, maintaining consistency in the visual representation.
Static POI Integration: The SDK enables the addition of static Points of Interest (POIs) to the indoor maps. This is accomplished through a configuration file in JSON format, which follows a specific predefined format. This feature allows developers to customize and enhance the map’s content with static location-based information.
By default, NAOMAPSDK uses the NAOSDK location provider. You can also configure it to use your own location provider.
Setting up your Android Studio Project
Add NAOMAPSDK as a dependency
This is the link for the production version
- Add the following line to your build.gradle
dependencies {
implementation 'eu.polestar:naomapsdk:+' // final '+' ensures you are using the latest version
}
- Add Pole Star maven url in your project gradle:
maven { url “https://dist.nao-cloud.com/android/maven/” }
API
To use NAOMAPSDK you must have an API key of your NAOCloud Site.
——————————————————————————————————————-
Init NAOMAPView
NaoMapView naoMapView;
naoMapView = new NaoMapView(getApplicationContext());
naoMapView.setActivity((FragmentActivity) activity);
setContentView(naoMapView);
Load maps with your API key
naoMapView.load(apiKeyUsed);
For applications using the self-hosted version of the NAO server (on premise). you need to specify the root url of NAO server
naoMapView.load(rootUrl, apiKeyUsed);
Use External location provider
- Implement ExternalLocationProvider in your map object
- Init & load NaoMapView with the external provider
- Define the provider name.
public class LocationOnMap extends AppCompatActivity implements ExternalLocationProvider {
private void initMapSdk(){
try {
/**
* launch NaoMapSDK
*/
naoMapView = new NaoMapView(getApplicationContext(), this);
setContentView(naoMapView);
naoMapView.load(apiKeyUsed);
}
catch (Exception e) {
Log.e(getClass().getSimpleName(), e.getMessage());
e.printStackTrace();
}
}
@Override
public String getName() {
return "your provider name";
}
}
- Set the location status to 'LocationStatus.AVAILABLE' with when location is available
naoMapView.setLocationStatus(LocationStatus.AVAILABLE);
public void onLocationChanged(Location loc) { // location changed from your provider
if(loc != null) {
if (naoMapView != null)
naoMapView.updateLocation(loc);
}
}
User can register as listener to map control callbacks. The NaoMapSdk invokes the didLoadSiteSuccess callback after attempting to load a map. On failure, it returns an error detailing why the map could not be loaded.
naoMapView.addMapControllerListener(new IMapControllerListener() {
@Override
public void didLoadSiteSuccess(boolean success, String message) {
if(!success)
showErrorDialog(message);
}
@Override
public void onSynchronizationProgress(double percentage) {}
@Override
public void didPathFound(boolean available, LocationProvider providerType) {}
@Override
public void didPathFinished(boolean finished) {}
});
import com.polestar.naomap.views.NaoMapView;
public class LocationOnMap extends AppCompatActivity implements NAOLocationListener, ExternalLocationProvider {
private NaoMapView naoMapView;
private void initMapSdk(){
try {
/**
* launch NaoMapSDK
*/
naoMapView = new NaoMapView(getApplicationContext(), this);
setContentView(naoMapView);
naoMapView.load(apiKeyUsed);
}
catch (Exception e) {
Log.e(getClass().getSimpleName(), e.getMessage());
e.printStackTrace();
}
}
public void onLocationChanged(Location loc) {
if(loc != null) {
if (naoMapView != null)
naoMapView.updateLocation(loc);
}
}
/**
* Methods of IlocationProvider
*/
@Override
public String getName() {
return "NAO Provider";
}
}
Customise the map display
You can also customise the way the map is displayed.
There has been a change since the production version. The customisation of the view is no longer done by specific methods, but by what is defined below.
Here is the list of parameters from the available to configure the map display.
Key | description |
---|---|
lockMapOnPositionBtn |
Force to center map on current location |
startPathSearchBtn |
Hide or show button to search for a path |
searchBtn |
Hide or show search bar |
floorBtn |
Hide or show floor buttons if use is false, Force to center position on map |
zoomInBtn |
Hide or show zoom IN buttons |
zoomOutBtn |
Hide or show zoom OUT buttons |
centerMapBtn |
Hide or show center on location button if visible is false , force to center position on map |
A configuration interface allows you to make buttons visible or invisible, depending on the choice.
- Using
setMapButtonsVisibilityConfig(byte[] configuration)
Based on a JSON formatted entry.{"mapNavigationButtons": {"zoomInBtn": true,"zoomOutBtn": true,"centerMapBtn": true},"lockMapOnPositionBtn": true,"searchBtn": true,"startPathSearchBtn": true,"floorBtn": true}Example
NaoMapView naoMapView; naoMapView = new NaoMapView(getApplicationContext()); naoMapView.setActivity(this); naoMapView.setMapButtonsVisibilityConfig(IOUtils.toByteArray(getAssets().open("map_configuration.json")));
- Using
setMapButtonsVisibilityConfig(MapButtonVisibilityConfig buttonVisibilityConfig)
Example
NaoMapView naoMapView; naoMapView = new NaoMapView(getApplicationContext()); naoMapView.setActivity(this); naoMapView.setMapButtonsVisibilityConfig(new MapButtonVisibilityConfig( new MapNavigationButtonVisibilityConfig(true, true, true), true, false, false, true ));
Adding POIs
You can add one or more POI (point of interest) using one of the following methods:
setPOI(byte[] poi) and setPOIs(byte[] pois) .
Both methods take a vector byte as argument. A single POI should has the following format:
{
"type": "object",
"properties": {
"location": {
"type": "object",
"properties": {
"longitude": {
"type": "number"
},
"latitude": {
"type": "number"
},
"altitude": {
"type": "number"
}
},
"required": [
"longitude",
"latitude",
"altitude"
]
},
"icon": {
"type": "string"
},
"name": {
"type": "string"
},
"category": {
"type": "string"
},
"metadata": {
"type": "object",
"properties": {},
"required": []
}
},
"required": [
"location",
"icon",
"name",
"category",
"metadata"
]
}
link for icon : https://fontawesome.com/search?q=thermo&o=r
Add unicode as a string icon.

This is an example of adding POIs
[
{
"location":{
"longitude":1.3872800433604597,
"latitude":43.56435614021779,
"altitude":10.0
},
"icon": "f491",
"name": "Thermometer",
"category": "TOOLS",
"metadata":{
"Name": "High Frequency X-ray Machine",
"Classification": "Imaging Diagnostic Equipment",
"Type": "X Ray Equipment"
}
},
{
"location":{
"longitude":1.387164,
"latitude":43.564311,
"altitude":5.0
},
"icon": "f48e",
"name": "Syringe",
"category": "TOOLS",
"metadata":{
"Name": "Autoclave",
"Type": "Pressure Steam Sterilization Equipments",
"Certification": "CE, ISO13485",
"Electric Tension": "380V",
"LCD Display": "With LCD Display",
"Ultra High Temperature Alarm": "Ultra High Temperature Alarm"
}
}
]
The metadata field is used to add the meta information which is displayed while you click on the POI icon. It is not mandatory and can be left empty dictionary.
if you want to add more POIs, you should provide the POIs in array format like the example
naoMapView?.setPOIs(context?.assets?.let { it.open("pois.geojson") }?.readBytes())