Skip to content

Navigation

Optional

Needed if your app shows routes or distances between points.

Introduction

Oriient's Indoor Positioning System (IPS) provides all the tools required to add to your application an Indoor Navigation service that is convenient and easy to use.

Implementation

Service Availability

The IPS Indoor Navigation service is not available if:

  • The user is not logged in. See Login guide for more details;
  • There is no internet connection.

Live Navigation

IPSNavigation can also be used as a live navigation service that will automatically react to position updates.

Defining the Waypoints

To start the navigation, you have to first define waypoints in the building on which you want to navigate. Each point should be represented using the IPSWaypoint interface.

Use IPSNavigation.setLiveNavigationWayPoints() to define the waypoints.

Observing Route updates

Use IPSNavigation.addLiveNavigationListener() and implement the methods declared in IPSLiveNavigationListener to manage the route updates and possible errors.

While there is at least one navigation listener, the SDK will rebuild the route each time there is a significant change in the position of the device. Likewise, the SDK will provide the new route using the onNavigationUpdate(@NonNull IPSRoute route) method. The contents of the IPSRoute object are described in the next section.

Important

Route updates won't be received while the user position is not locked. See IPSPositioning.isPositionLocked().

Info

Live navigation updates can be stopped and restarted using IPSNavigation.setLiveNavigationEnabled().

Turn-by-Turn Navigation

Experimental API

Turn-by-turn navigation is considered experimental and subject to change or removal in future updates.

In addition to the live-navigation route, the SDK can provide step-by-step turn-by-turn instructions. Enable it with IPSNavigation.setTurnByTurnNavigationEnabled() (disabled by default), then add a listener implementing IPSTurnByTurnNavigationListener via IPSNavigation.addTurnByTurnNavigationListener():

IPSNavigation.setTurnByTurnNavigationEnabled(true)
IPSNavigation.addTurnByTurnNavigationListener(object : IPSTurnByTurnNavigationListener {
    override fun onTurnByTurnNavigationInstructionsUpdate(instructions: List<IPSTurnByTurnNavigationInstruction>) {
        for (instruction in instructions) {
            val direction = instruction.getDirection() // e.g. Turn(direction), ContinueStraight, TakeElevator(direction, destinationFloor), Arrived
            val distance = instruction.getDistance() // distance from the previous instruction, in meters
        }
    }

    override fun onNavigationManeuversUpdate(maneuvers: List<IPSTurnByTurnNavigationManeuver>) {
        // Lower-level maneuver updates, if your UI needs more granularity than instructions
    }
})

Each IPSTurnByTurnNavigationInstruction has a direction (IPSTurnByTurnManeuverDirection — Turn, TurnAround, TurnAroundToPath, ContinueStraight, ContinueStraightToDestination, TakeEscalator, TakeElevator, TakeStairs, TakeRamp, Arrived) and a distance in meters from the previous instruction.

Requesting a static Route between points of interest

If you wish to make a single request to the navigation service, use IPSNavigation.findRouteInBuilding(), to find an optimal route between the waypoints which you provide to the method. This endpoint is mainly used to calculate a static route from entrance to be presented to the user before the position gets locked.

Data Structure

Route Representation

The resulting route is represented by the IPSRoute object. The IPSRoute object contains:

  • The coordinates of the route in the building IPSRoute.getRouteCoordinates().
  • The floor transitions on the route IPSRoute.getFloorTransitions().
  • Waypoints used in building of the route, sorted according to the order in which those points should be visited. For live navigation updates the first waypoint is the device location the moment the route was initially built IPSRoute.getWaypoints(). Otherwise, the first waypoint will remain the first one that was provided.
  • The route consists of more coordinates than the number of waypoints on it. This method provides the indexes of the route coordinates, corresponding to the waypoints on the route, as they appear in IPSRoute.getRouteCoordinates() (IPSRoute.getIndexOnRoute()). For example, the second waypoint may correspond to the 10th coordinate on the route so IPSRoute.getIndexOnRoute(secondWaypoint) = 10.
  • Distances, in meters, from the start of the route, to each waypoint IPSRoute.getDistanceFromStart(waypoint).
  • Distances, in meters, from the start of the route, to each floor transition IPSRoute.getDistanceFromStart(floorTransition).
  • Information weather a waypoint is located on this route or not IPSRoute.isWaypointOnRoute().
  • Information weather a floor transition is located on this route or not IPSRoute.isFloorTransitionOnRoute().

Distance Between Objects

To find the distance between two points on the map (for example, between the user and a product), request a route between them with IPSNavigation.findRouteInBuilding() and read IPSRoute.getDistanceFromStart() for the second waypoint:

val userWaypoint = IPSWaypointModel(id = UUID.randomUUID().toString(), x = userCoordinate.x, y = userCoordinate.y, floorOrder = userFloorOrder, buildingId = buildingId)
val productWaypoint = IPSWaypointModel(id = UUID.randomUUID().toString(), x = productCoordinate.x, y = productCoordinate.y, floorOrder = productFloorOrder, buildingId = buildingId)

IPSNavigation.findRouteInBuilding(buildingId, listOf(userWaypoint, productWaypoint), object : IPSRouteListener {
    override fun onError(error: IPSError) {
    }

    override fun onRouteReceived(route: IPSRoute) {
        val distance = route.getDistanceFromStart(productWaypoint)
    }
})

Info

Both waypoints must be reachable by a walkable route.