실시간 중단 구성
실시간 교통 체증은 경로상의 교통 체증에 관해 사용자에게 알리고 사용자가 발견한 교통 체증을 신고하고 확인할 수 있도록 지원하는 기능 모음입니다. 교통 체증, 경찰 및 속도 카메라 존재, 공사, 차선 폐쇄, 특정 날씨 조건 등이 있습니다. 이 페이지에서는 맞춤 탐색 UI를 사용하는 앱의 고려사항을 비롯하여 실시간 방해 요소 기능과 구성 옵션을 설명합니다.
실시간 중단 기능
Navigation SDK에는 핵심 탐색 환경의 일부로 다음과 같은 실시간 중단 기능이 포함되어 있습니다.이러한 기능은 구성 가능하며 기본적으로 사용 설정되어 있습니다. 다음 섹션에서는 기능과 사용 가능한 구성 옵션에 대해 자세히 설명합니다.
경로를 따라 표시되는 대화형 중단 알림
앱이 경로 개요에 또는 활성 탐색 중에 경로를 표시하면 현재 중단이 경로를 따라 콜아웃으로 표시됩니다. 콜아웃에는 중단 유형을 나타내는 아이콘이 포함됩니다.

shouldDisplayPrompts
를 사용하여 경로를 따라 중단 콜아웃의 표시를 제어할 수 있으며, 이는 사용자가 중단에 접근할 때 자동 알림의 표시도 제어합니다.
mapView.navigator.shouldDisplayPrompts = true
사용자가 콜아웃을 탭하면 중단 세부정보 표시
사용자는 풍선을 탭하여 중단 유형, 마지막으로 신고된 시간, 중단이 아직 존재하는지 여부를 투표하는 옵션 등 중단에 관한 자세한 정보가 포함된 정보 카드를 표시할 수 있습니다. 사용자가 활성 탐색 중인지에 따라 표시될 수 있는 정보 카드에는 두 가지 유형이 있으며, 각 유형에 따라 구성 옵션이 다릅니다.
활성 내비게이션을 시작하기 전 경로 개요의 콜아웃 정보 카드
사용자가 활성 내비게이션을 시작하기 전에 경로 개요에서 풍선을 탭하면 중단에 관한 자세한 정보가 포함된 정보 카드가 표시됩니다.

showsIncidentCards
을 사용하여 사용자가 경로 개요에서 중단 콜아웃을 탭하여 자세한 정보를 표시하는 기능을 제어할 수 있습니다.
mapView.settings.showsIncidentCards = true
활성 내비게이션 중 콜아웃 정보 카드
활성 탐색 중에 경로를 따라 중단 콜아웃이 표시되면 사용자는 콜아웃을 탭하여 중단 유형, 마지막으로 신고된 시간 등 중단에 관한 자세한 정보가 포함된 정보 카드와 중단이 아직 있는지 투표하는 버튼을 표시할 수 있습니다. 사용자가 제출한 투표는 Google에서 처리하며 다른 Google 지도 사용자 및 내비게이션 SDK 사용자에게 지도에 표시될 수 있고, 중단을 계속 표시할지 여부를 결정하는 데 사용될 수도 있습니다.

shouldDisplayPrompts
를 사용하여 활성 탐색 중에 중단 콜아웃의 표시와 탭 가능 여부를 제어할 수 있습니다. shouldDisplayPrompts
는 경로를 따라 콜아웃 표시와 사용자가 중단에 접근할 때 자동 알림 표시도 제어합니다.
mapView.navigator.shouldDisplayPrompts = true
활성 탐색 중에 투표를 지원하는 자동 중단 알림
활성 탐색 중에 사용자가 경로를 따라 중단에 접근하면 중단에 관한 정보와 중단이 아직 있는지에 관해 투표할 수 있는 버튼이 포함된 메시지가 표시됩니다. 사용자가 제출한 투표는 Google에서 처리하며, 다른 Google 지도 및 내비게이션 SDK 사용자에게 지도에 표시될 수 있고, 중단을 계속 표시할지 여부를 결정하는 데 사용될 수 있습니다.

활성 탐색 중에 알림 메시지 표시를 구성하려면 shouldDisplayPrompts
를 사용하세요. 이 설정은 경로를 따라 콜아웃 표시도 제어합니다.
mapView.navigator.shouldDisplayPrompts = true
내비게이션 중에 교통체증 신고
활성 탐색 모드에서는 사용자가 경로를 따라 새로운 방해 요소를 신고할 수 있는 버튼이 탐색 UI에 표시됩니다. 사용자가 버튼을 탭하면 신고할 수 있는 중단 유형이 포함된 메뉴가 표시됩니다. 사용자가 제출한 신고는 Google에서 처리하며 다른 Google 지도 및 Navigation SDK 사용자에게 지도에 표시될 수 있습니다.


표준 보고 버튼 표시 또는 숨기기
navigationReportIncidentButtonEnabled
를 사용하여 활성 탐색 중에 표준 보고 버튼의 표시 여부를 구성할 수 있습니다.
// Enables the incident reporting FAB to show in situations where incident // reporting is possible. mapView.settings.navigationReportIncidentButtonEnabled = true
맞춤 신고 버튼 추가
표준 중단 신고 버튼 대신 탐색 UI에 맞춤 신고 버튼을 추가할 수 있습니다. 사용자가 맞춤 버튼을 클릭하면 presentReportIncidentsPanel
메서드를 호출하여 신고 메뉴의 표시를 트리거할 수 있습니다. 맞춤 신고 버튼을 추가하기 전에 reportIncidentsAvailable
를 호출하여 앱이 활성 탐색 상태이고 사용자가 신고가 사용 설정된 국가에 있는지 확인합니다. 이 중 하나라도 사실이 아닌 경우 보고 메뉴가 표시되지 않습니다.
// Check if reporting is available before displaying your button let isReportingAvailable = mapview.isIncidentReportingAvailable() customReportingIncidentButton.isHidden = !isReportingAvailable customReportingIncidentButton.addTarget(self, action: #selector(didTapReportIncidentButton), for: .touchUpInside) // Trigger the reporting flow if the button is clicked func didTapReportIncidentButton() { mapView.presentReportIncidentsPanel(self) { [weak self] error in guard let self = self else { return } if let error = error as NSError? { if error.domain == GMSMapViewPresentReportIncidentPanelErrorDomain { let errorCode = GMSMapViewPresentReportIncidentPanelErrorCode(rawValue: error.code) switch errorCode { case .internal: self.showErrorMessage( title: "Error Presenting Report Incident Panel", message: "An internal error occurred." ) case .reportingNotAvailable: self.showErrorMessage( title: "Error Presenting Report Incident Panel", message: "Reporting is not available." ) case .none: self.showErrorMessage( title: "Error Presenting Report Incident Panel", message: "An unknown error occurred." ) } } else { // Handle other potential errors (e.g., network errors) self.showErrorMessage( title: "Error Presenting Report Incident Panel", message: "An unexpected error occurred: \(error.localizedDescription)" ) } } // If error is nil, the panel was presented successfully. You can add any extra logic here. } }
맞춤 탐색 UI 사용
Navigation SDK 구현에 맞춤 UI 요소가 포함된 경우 충돌을 방지하기 위해 실시간 중단 요소를 고려해야 합니다.
보고 버튼 위치
기본적으로 중단 신고 버튼은 지도 하단 끝/후행 모서리에 배치됩니다. 왼쪽에서 오른쪽으로 쓰는 언어의 경우 오른쪽, 오른쪽에서 왼쪽으로 쓰는 언어의 경우 왼쪽입니다. 맞춤 UI 요소를 위한 공간을 확보하기 위해 보고 버튼을 이동해야 하는 경우bottomTrailingButtonsLayoutGuide
를 사용하세요.
Swift
// Create a new layout guide let topRightLayoutGuide = UILayoutGuide() self.view.addLayoutGuide(topRightLayoutGuide) // Activate constraints using fixed constants here as an example // assuming the current reporting button is of fixed height topRightLayoutGuide.topAnchor.constraint(equalTo: _mapView.navigationHeaderLayoutGuide.bottomAnchor, constant: 50).isActive = true topRightLayoutGuide.trailingAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.trailingAnchor, constant: -14).isActive = true // Assign the layout guide _mapView.bottomTrailingButtonsLayoutGuide = topRightLayoutGuide // Create an alternate layout guide to use when the header and the footer are not full width let topRightAlternateLayoutGuide = UILayoutGuide() self.view.addLayoutGuide(topRightAlternateLayoutGuide) // Activate constraints using fixed constants here as an example // assuming the current RTD button is of fixed height topRightAlternateLayoutGuide.topAnchor.constraint(equalTo: _mapView.navigationHeaderLayoutGuide.bottomAnchor, constant: 20).isActive = true topRightAlternateLayoutGuide.trailingAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.trailingAnchor, constant: -10).isActive = true // Assign the layout guide _mapView.bottomTrailingButtonsAlternateLayoutGuide = topRightAlternateLayoutGuide
Objective-C
// Create a new layout guide UILayoutGuide *topRightLayoutGuide = [[UILayoutGuide alloc] init]; [self.view addLayoutGuide:topRightLayoutGuide]; // Activate constraints using fixed constants here as an example // assuming the current RTD button is of fixed height [[topRightLayoutGuide.topAnchor constraintEqualToAnchor:_mapView.navigationHeaderLayoutGuide.bottomAnchor constant:50] setActive:YES]; [[topRightLayoutGuide.trailingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.trailingAnchor constant:-14] setActive:YES]; // Assign the layout guide _mapView.bottomTrailingButtonsLayoutGuide = topRightLayoutGuide; // Create an alternate layout guide to use when the header and the footer are not full width UILayoutGuide *topRightAlternateLayoutGuide = [[UILayoutGuide alloc] init]; [self.view addLayoutGuide:topRightAlternateLayoutGuide]; // Activate constraints using fixed constants here as an example // assuming the current RTD button is of fixed height [[topRightAlternateLayoutGuide.topAnchor constraintEqualToAnchor:_mapView.navigationHeaderLayoutGuide.bottomAnchor constant:50] setActive:YES]; [[topRightAlternateLayoutGuide.trailingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.trailingAnchor constant:-14] setActive:YES]; // Assign the layout guide _mapView.bottomTrailingButtonsAlternateLayoutGuide = topRightAlternateLayoutGuide;
프롬프트 표시 가능 여부 API (실험적)
프롬프트 표시 가능 여부 API를 사용하면 탐색 SDK에서 생성된 UI 요소와 자체 맞춤 UI 요소 간의 충돌을 방지할 수 있습니다. 탐색 SDK UI 요소가 표시되기 직전과 요소가 삭제되는 즉시 콜백을 수신하는 리스너를 추가하면 됩니다. 정보 카드, 메시지, 교통 체증 신고 메뉴 등 실시간 교통 체증 요소와 Navigation SDK에서 생성된 기타 알림에 대한 콜백을 수신할 수 있습니다.Swift
// Additional methods added to GMSNavigatorListener ... func navigatorWillPresentPrompt(_ navigator: GMSNavigator) { // Hide any sort of custom UI element. } func navigatorDidDismissPrompt(_ navigator: GMSNavigator) { // Show any sort of custom UI element. } ...
Objective-C
// Additional methods added to GMSNavigatorListener ... - (void)navigatorWillPresentPrompt:(GMSNavigator *)navigator { // Hide any sort of custom UI element. } - (void)navigatorDidDismissPrompt:(GMSNavigator *)navigator { // Show any sort of custom UI element. } ...