Définir la destination dans l'application chauffeur
Après avoir associé un consommateur à un chauffeur, vous devez configurer la destination du trajet dans l'application du chauffeur en procédant comme suit :
Récupérez la destination du véhicule à partir de sa collection de points de cheminement dans Fleet Engine, qui est renvoyée par GetTrip(), UpdateTrip() et GetVehicle().
Définissez la destination en appelant la méthode setDestinations() du SDK Navigation pour iOS.
Les exemples suivants montrent comment définir la destination dans l'application chauffeur.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/08/31 (UTC).
[null,null,["Dernière mise à jour le 2025/08/31 (UTC)."],[[["\u003cp\u003eThis guide explains how to set a vehicle's destination in the driver app after a trip is matched.\u003c/p\u003e\n"],["\u003cp\u003eYou need to retrieve the destination waypoints from Fleet Engine's \u003ccode\u003eGetTrip()\u003c/code\u003e, \u003ccode\u003eUpdateTrip()\u003c/code\u003e, or \u003ccode\u003eGetVehicle()\u003c/code\u003e methods.\u003c/p\u003e\n"],["\u003cp\u003eUse the Navigation SDK for iOS \u003ccode\u003esetDestinations()\u003c/code\u003e method to set the destination in the driver app, ensuring coordinates match the trip's waypoint for proper consumer app rendering.\u003c/p\u003e\n"]]],[],null,["# Set the vehicle's destination\n\nThis section documents how to set the vehicle's destination after your server\nmatches a trip to a vehicle.\n\nBefore you begin\n----------------\n\nThis section requires you to have completed the following:\n\n- [Initialize the Driver SDK](/maps/documentation/mobility/driver-sdk/on-demand/ios/initialize-sdk)\n- [Get the vehicle ready](/maps/documentation/mobility/driver-sdk/on-demand/ios/vehicle-ready)\n- [Create a trip in Fleet Engine](/maps/documentation/mobility/fleet-engine/journeys/trips/create-trip)\n\nSet the destination in the driver app\n-------------------------------------\n\nAfter you have paired a consumer with a driver, you must configure the trip's\ndestination in the driver app by performing the following steps:\n\n1. Retrieve the vehicle's destination from its waypoints collection in Fleet\n Engine, which is returned by `GetTrip()`, `UpdateTrip()` and `GetVehicle()`.\n\n2. Set the destination by calling the Navigation SDK for iOS method\n [`setDestinations()`](/maps/documentation/navigation-sdk-ios/reference/interface_g_m_s_navigator#ae62d9db4071a0df6c3651b9675356df8).\n\n | **Note:** For the consumer app to properly render the trip, make sure the geographic latitude/longitude coordinates supplied to `setDestinations()` match those in the trip's waypoint. For more information, see the tutorial [Navigate a route](/maps/documentation/navigation/ios-sdk/route).\n\nThe following examples show how to set the destination in the driver\napp. \n\n### Swift\n\n private func startNavigation() {\n let destinations = [\n GMSNavigationWaypoint(\n placeID: \"ChIJnUYTpNASkFQR_gSty5kyoUk\", title: \"PCC Natural Market\"),\n GMSNavigationWaypoint(\n placeID: \"ChIJJ326ROcSkFQRBfUzOL2DSbo\", title: \"Marina Park\"),\n ]\n\n mapView.navigator?.setDestinations(destinations, callback: { routeStatus in\n guard routeStatus == .OK else {\n // Error starting navigation.\n return\n }\n mapView.locationSimulator?.simulateLocationsAlongExistingRoute()\n mapView.navigator?.isGuidanceActive = true\n mapView.navigator?.sendsBackgroundNotifications = true\n mapView.cameraMode = .following\n })\n }\n\n### Objective-C\n\n - (void)startNavigation {\n NSArray\u003cGMSNavigationWaypoint *\u003e *destinations =\n @[[[GMSNavigationWaypoint alloc] initWithPlaceID:@\"ChIJnUYTpNASkFQR_gSty5kyoUk\"\n title:@\"PCC Natural Market\"],\n [[GMSNavigationWaypoint alloc] initWithPlaceID:@\"ChIJJ326ROcSkFQRBfUzOL2DSbo\"\n title:@\"Marina Park\"]];\n\n [_mapView.navigator setDestinations:destinations\n callback:^(GMSRouteStatus routeStatus) {\n if (routeStatus != GMSRouteStatusOK) {\n // Error starting navigation.\n return;\n }\n [_mapView.locationSimulator simulateLocationsAlongExistingRoute];\n _mapView.navigator.guidanceActive = YES;\n _mapView.navigator.sendsBackgroundNotifications = YES;\n _mapView.cameraMode = GMSNavigationCameraModeFollowing;\n }];\n }"]]