Aracın hedefini belirleyin

Bu bölümde, sunucunuz bir seyahat için bir araçla eşleştikten sonra aracın hedefini nasıl ayarlayacağınız açıklanmaktadır.

Başlamadan önce

Bu bölüm için aşağıdaki işlemleri tamamlamış olmanız gerekir:

Sürücü uygulamasında hedefi ayarlayın

Bir tüketiciyi bir sürücüyle eşledikten sonra, yolculuğun aşağıdaki adımları uygulayarak sürücü uygulamasındaki hedef:

  1. Aracın hedefini Filo'daki ara noktaları koleksiyonundan alın GetTrip(), UpdateTrip() ve GetVehicle() tarafından döndürülen motor.

  2. iOS için Navigasyon SDK'sı yöntemini setDestinations() çağırarak hedefi ayarlayın.

Aşağıdaki örneklerde, sürücüde hedefin nasıl ayarlanacağı gösterilmektedir uygulamasını indirin.

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;
                             }];
}