Never get lost inside any big venue anymore

The latest news; an Indoor Navigation app which shows you where you are inside a building and how to get to your destination, and its now available in the Westfriesgasthuis; a Dutch hospital with an area of 80.000 square meters. The Dutch hospital has the first large-scale implementation of Indoor Navigation. Through their recently launched app; the WFGwegwijzer; they allow visitors to navigate to anywhere in the Hospital, without ever getting lost again.

I am particularly proud of this achievement because I helped on it. The app uses the technology of Movin to enable Indoor Navigation in their app through the Movin SDK. The app itself was developed by NavigationID and Mobile Agency, who have used the SDK in the same manner as I will demonstrate in this article. Movin is a Dutch start-up, specialized in Indoor Navigation. I work for Movin and I have developed the Movin SDK that enables other app developers to integrate Indoor Navigation in their iOS and Android apps. Movin focusses on positioning, mapping and routing.

 

Today I want to talk about Indoor Positioning, one of the major aspects of Indoor Navigation. For Indoor Positioning you’ll need something special, since GPS will not work indoors. Movin uses iBeacons for that. iBeacons are small Bluetooth Low Energy devices that transmit a static signal which corresponds to the iBeacon standard as defined by Apple.

For Indoor Positioning, iBeacons need to be placed in the venue and a site-survey needs to be performed. I will skip these steps and go straight to the integration in your app. First of all, the Movin SDK needs to be downloaded, this can be done via our Github. If you have the iBeacons in your venue and the site-survey is performed, Movin will provide you with the remaining necessities:

  • Customer-code
  • Apikey
  • Map-ID

For convenience, I’ll just focus on the Android SDK for now, but if the need arises for a tutorial on the iOS SDK, I will do so.

 

It is actually quite simple to integrate Indoor Positioning inside your app, you’ll just have to do the following things:

  1. Integrate the SDK in your application project
  2. Initialize the SDK
  3. Create a Positioning Engine
  4. Implement a Positioning Listener

So lets start with the integration. If you have downloaded the Movin SDK for android, you should have a movinsdk.jar. This jar file needs to be included in you application project, which is nothing more than copying it into the libs folder of your project folder.

So lets start with the SDK initialization:

// Initialize the Movin SDK with the three parameters provided by Movin, the Android Context and a callback.
// The parameters provided by Movin:
//    - customer code
//    - apikey
//    - map id
MovinSDK.initialize("customer-code", "apikey", "map-id", getApplicationContext(), new MovinSDKCallback() {
	
	@Override
	public void initialized(boolean success, Exception ex) {
		if(success) {
			// The MovinSDK was succesfully initialized, now a PositioningEngine can be created
		} else {
			// The MovinSDK could not be initialized, due to the following exception
			System.out.println("Error initializing the MovinSDK: " + ex.getLocalizedMessage());
			ex.printStackTrace();
		}
	}
});

After that, we can create a Positioning Engine. Its a best practice to define the Positioning Engine as a property of a class (for example MainActivity) like so:

private MovinPositioningEngine positioningEngine;

The following code example shows how to instantiate the Positioning Engine.

try {
	// Create the positioning engine
	positioningEngine = MovinSDK.createPositioningEngine();
} catch(Exception ex) {
	// Log if anything went wrong
	System.out.println("Error creating positioning engine: " + ex.getLocalizedMessage());
	ex.printStackTrace();
}

The last step is to implement a Positioning Listener and start the engine, which goes as following:

// Add a positioning listener
positioningEngine.addPositioningListener(new MovinPositioningListener() {
	
	@Override
	public void updatedPosition(FloorPosition floorPos) {
		// A new position has been calculated
		// Note that this method is called around 30 times per second, so its frequent enough to create a smooth positioning experience.
		// Extract the position data:
		float floor = floorPos.floor;
		GeoLatLng coordinate = floorPos.position;
		double latitude = coordinate.lat;
		double longitude = coordinate.lng;
	}
	
	@Override
	public void unknownLocation() {
		// There are no longer iBeacons nearby to determine an accurate position
	}
	
	@Override
	public void lostConnection() {
		// The connection to the server is lost, which is required for positioning
	}
});

// Start the positioning engine
positioningEngine.start();

// Stop the positioning engine once finished
positioningEngine.stop();

What you do with the positions you get is up to you, but they’re in the GPS format, so its super easy to integrate the positions you get with Google Maps for example.

If there are any questions on the implementation, just leave a message in the comments.