Route geofencing (v2.1.x - Android)

The core component of Navmii SDK responsible for route geofencing is RouteGeofenceManager. This class provides an API that allows getting notifications of transition events within a route with a specified tolerance.

 

CREATING ROUTE GEOFENCE MANAGER

Sdk class contains getRouteGeofenceManager method which allows the Navmii SDK user to access the route geofence manager instance. The route geofence manager instance can only be accessed if the SDK is started. Use setRoute method to set the current route and setAccuracy method to set an accuracy in meters.

 

ROUTE GEOFENCE EVENTS

The route geofence manager provides a RouteGeofenceListener interface to handle transition events:

  • onRouteGeofenceEnter(String routeName)

  • onRouteGeofenceExit(String routeName)

You can add listeners using addRouteGeofenceListener method:

sdk.getRouteGeofenceManage().addRouteGeofenceListener(routeGeofenceListener);

Use removeRouteGeofenceListener method to detach the listener :

sdk.getRouteGeofenceManage().removeRouteGeofenceListener(routeGeofenceListener);