הגדרת יעד הרכב

בקטע הזה מוסבר איך להגדיר את יעד הרכב אחרי השרת תואם נסיעה לרכב.

לפני שמתחילים

בקטע הזה עליכם לבצע את הפעולות הבאות:

הגדרת היעד באפליקציית הנהג

אחרי שהתאמת בין לקוח לנהג, צריך להגדיר את באפליקציה לנהג/ת:

  1. אחזור יעד הרכב מאוסף ציוני הדרך שלו ב-Fleet מנוע, שהוחזר על ידי GetTrip(), UpdateTrip() ו-GetVehicle().

  2. כדי להגדיר את היעד, צריך להפעיל את Navigation SDK ל-iOS setDestinations()

בדוגמאות הבאות אפשר לראות איך מגדירים את היעד בנהג. אפליקציה.

Swift

private func startNavigation() {
  let destinations = [
    GMSNavigationWaypoint(
      placeID: "ChIJnUYTpNASkFQR_gSty5kyoUk", title: "PCC Natural Market"),
    GMSNavigationWaypoint(
      placeID: "ChIJJ326ROcSkFQRBfUzOL2DSbo", title: "Marina Park"),
  ]

  mapView.navigator?.setDestinations(destinations, callback: { routeStatus in
    guard routeStatus == .OK else {
      // Error starting navigation.
      return
    }
    mapView.locationSimulator?.simulateLocationsAlongExistingRoute()
    mapView.navigator?.isGuidanceActive = true
    mapView.navigator?.sendsBackgroundNotifications = true
    mapView.cameraMode = .following
  })
}

Objective-C

- (void)startNavigation {
  NSArray<GMSNavigationWaypoint *> *destinations =
  @[[[GMSNavigationWaypoint alloc] initWithPlaceID:@"ChIJnUYTpNASkFQR_gSty5kyoUk"
                                             title:@"PCC Natural Market"],
    [[GMSNavigationWaypoint alloc] initWithPlaceID:@"ChIJJ326ROcSkFQRBfUzOL2DSbo"
                                             title:@"Marina Park"]];

  [_mapView.navigator setDestinations:destinations
                             callback:^(GMSRouteStatus routeStatus) {
                               if (routeStatus != GMSRouteStatusOK) {
                                 // Error starting navigation.
                                 return;
                               }
                               [_mapView.locationSimulator simulateLocationsAlongExistingRoute];
                               _mapView.navigator.guidanceActive = YES;
                               _mapView.navigator.sendsBackgroundNotifications = YES;
                               _mapView.cameraMode = GMSNavigationCameraModeFollowing;
                             }];
}