libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/offroute/OffRouteDetector.java
private boolean validOffRoute(Location location, MapboxNavigationOptions options) {
    // Check if minimum amount of distance has been passed since last reroute
    Point currentPoint = Point.fromLngLat(location.getLongitude(), location.getLatitude());
    double distanceFromLastReroute = 0d;
    if (lastReroutePoint != null) {
      distanceFromLastReroute = TurfMeasurement.distance(lastReroutePoint,
        currentPoint, TurfConstants.UNIT_METERS);
    } else {
      // If null, this is our first update - set the last reroute point to the given location
      updateLastReroutePoint(location);
    }
    return distanceFromLastReroute > options.minimumDistanceBeforeRerouting();
  }
/**
   * Method to check if the user has passed either the set (in {@link MapboxNavigationOptions})
   * minimum amount of seconds or minimum amount of meters since the last reroute.
   * <p>
   * If the user is above both thresholds, then the off-route can proceed.  Otherwise, ignore.
   *
   * @param location current location from engine
   * @param options  for second (default 3) / distance (default 50m) minimums
   * @return true if valid, false if not
   */
Method to check if the user has passed either the set (in  MapboxNavigationOptions)
minimum amount of seconds or minimum amount of meters since the last reroute.

If the user is above both thresholds, then the off-route can proceed.  Otherwise, ignore.

@param location current location from engine
@param options  for second (default 3) / distance (default 50m) minimums
@return true if valid, false if not
Method to check if the user has passed either the set ( in MapboxNavigationOptions ) minimum amount of seconds or minimum amount of meters since the last reroute . If the user is above both thresholds then the off - route can proceed . Otherwise ignore . @param location current location from engine @param options for second ( default 3 ) / distance ( default 50m ) minimums @return true if valid false if not
private boolean validOffRoute(Location location, MapboxNavigationOptions options) {
    Point currentPoint = Point.fromLngLat(location.getLongitude(), location.getLatitude());
    double distanceFromLastReroute = 0d;
    if (lastReroutePoint != null) {
      distanceFromLastReroute = TurfMeasurement.distance(lastReroutePoint,
        currentPoint, TurfConstants.UNIT_METERS);
    } else {
      updateLastReroutePoint(location);
    }
    return distanceFromLastReroute > options.minimumDistanceBeforeRerouting();
  }
private boolean validOffRoute ( Location location , MapboxNavigationOptions options ) { Point currentPoint = Point . fromLngLat ( location . getLongitude ( ) , location . getLatitude ( ) ) ; double distanceFromLastReroute = 0d ; if ( lastReroutePoint != null ) { distanceFromLastReroute = TurfMeasurement . distance ( lastReroutePoint , currentPoint , TurfConstants . UNIT_METERS ) ; } else { updateLastReroutePoint ( location ) ; } return distanceFromLastReroute > options . minimumDistanceBeforeRerouting ( ) ; }
Method to check if the user has passed either the set (in {@link MapboxNavigationOptions})
 minimum amount of seconds or minimum amount of meters since the last reroute.
Method to check if the user has passed either the set ( in { @link MapboxNavigationOptions } ) minimum amount of seconds or minimum amount of meters since the last reroute .
// Check if minimum amount of distance has been passed since last reroute // If null, this is our first update - set the last reroute point to the given location