속도계 알림 구성
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
탐색이 사용 설정되고 이동 모드가 운전으로 설정되면 iOS용 탐색 SDK는 현재 제한 속도를 보여주는 제한 속도 컨트롤을 지도의 왼쪽 하단에 표시합니다. 운전자가 제한 속도를 초과하면 컨트롤이 확장되어 제한 속도 표시 옆에 속도계가 표시되고 속도가 특정 기준점에 도달하면 알림이 트리거됩니다.
기본적으로 Navigation SDK는 운전자가 제한 속도를 5mph (또는 10kph) 초과하면 경미한 속도 알림을 트리거하고 속도계 텍스트의 색상을 빨간색으로 변경합니다. 운전자가 제한 속도를 16km/h (10mph) 초과하면 심각한 속도 알림이 트리거되고 속도계 배경색이 빨간색으로 바뀝니다.
알림을 트리거하는 기준점과 속도계에 표시되는 텍스트 및 배경색을 모두 맞춤설정할 수 있습니다. Navigation SDK를 사용하여 운전자의 속도 정보를 제공할 수도 있습니다. 예를 들어 차량 공유 서비스 운영자가 운전자가 제한 속도를 준수하고 안전을 개선하도록 장려할 수 있도록 속도 정보를 제공할 수 있습니다.
속도 알림 기준 맞춤설정
현재 속도의 제한 속도에 대한 백분율로 경미한 속도 알림과 심각한 속도 알림의 속도 알림 기준점을 맞춤설정할 수 있습니다. 지도가 알림을 표시하기 전에 임곗값을 초과하는 기간을 지정할 수도 있습니다.
다음 코드 예시에서는 경미한 속도 알림의 기준을 제한 속도보다 5% 높게, 심각한 속도 알림의 기준을 제한 속도보다 10% 높게 설정합니다. 경고 임곗값이 5초 동안 초과된 후 지도가 경고를 표시하도록 지정합니다.
Swift
let minorSpeedAlertThresholdPercentage: CGFloat = 0.05 let
majorSpeedAlertThresholdPercentage: CGFloat = 0.1 let
severityUpgradeDurationSeconds: TimeInterval = 5
// Configure SpeedAlertOptions let mutableSpeedAlertOptions:
GMSNavigationMutableSpeedAlertOptions = GMSNavigationMutableSpeedAlertOptions()
mutableSpeedAlertOptions.setSpeedAlertThresholdPercentage(minorSpeedAlertThresholdPercentage,
for: .minor)
mutableSpeedAlertOptions.setSpeedAlertThresholdPercentage(majorSpeedAlertThresholdPercentage,
for: .major) mutableSpeedAlertOptions.severityUpgradeDurationSeconds =
severityUpgradeDurationSeconds
// Set SpeedAlertOptions to Navigator. mapView.navigator?.speedAlertOptions =
mutableSpeedAlertOptions; mapView.navigator?.add(self); // Only needed if
listening to the delegate events.
Objective-C
static const CGFloat minorSpeedAlertThresholdPercentage = 0.05; static const
CGFloat majorSpeedAlertThresholdPercentage = 0.1; static const NSTimeInterval
severityUpgradeDurationSeconds = 5;
// Configure SpeedAlertOptions GMSNavigationMutableSpeedAlertOptions
*mutableSpeedAlertOptions = [[GMSNavigationMutableSpeedAlertOptions alloc]
init]; [mutableSpeedAlertOptions setSpeedAlertThresholdPercentage:
minorSpeedAlertThresholdPercentage
forSpeedAlertSeverity:GMSNavigationSpeedAlertSeverityMinor];
[mutableSpeedAlertOptions
setSpeedAlertThresholdPercentage:majorSpeedAlertThresholdPercentage
forSpeedAlertSeverity:GMSNavigationSpeedAlertSeverityMajor];
[mutableSpeedAlertOptions
setSeverityUpgradeDurationSeconds:severityUpgradeDurationSeconds];
// Set SpeedAlertOptions to Navigator. mapView.navigator.speedAlertOptions =
mutableSpeedAlertOptions; [mapView.navigator addListener:self]; // Only needed
if listening to the delegate events.
속도계에서 속도 알림을 표시하는 방식 맞춤설정
각 알림 수준에 대해 속도계 표시의 색상을 맞춤설정할 수 있습니다.
다음 표에는 GMSNavigationSpeedometerUIOptions
클래스의 속도 알림에 사용되는 기본 색상이 나와 있습니다.
요소 | 색상 |
MinorSpeedAlertBackgroundColorDayMode |
0xffffff(흰색) |
MinorSpeedAlertBackgroundColorNightMode |
0x000000 |
MinorSpeedAlertTextColorDayMode |
0xd93025 |
MinorSpeedAlertTextColorNightMode |
0xd93025 |
MajorSpeedAlertBackgroundColorDayMode |
0xd93025 |
MajorSpeedAlertBackgroundColorNightMode |
0xd93025 |
MajorSpeedAlertTextColorDayMode |
0xffffff(흰색) |
MajorSpeedAlertTextColorNightMode |
0xffffff(흰색) |
사소한 속도 알림과 심각한 속도 알림 모두에 대해 속도계의 텍스트 및 배경 색상을 지정할 수 있습니다.
Swift
let mutableSpeedometerUIOptions: GMSNavigationMutableSpeedometerUIOptions =
GMSNavigationMutableSpeedometerUIOptions()
mutableSpeedometerUIOptions.setTextColor(minorSpeedAlertTextColor, for: .minor,
lightingMode: .normal)
mutableSpeedometerUIOptions.setTextColor(majorSpeedAlertTextColor, for: .major,
lightingMode: .normal)
mutableSpeedometerUIOptions.setBackgroundColor(minorSpeedAlertNightModeBackgroundColor,
for: .minor, lightingMode: .lowLight)
mutableSpeedometerUIOptions.setBackgroundColor(majorSpeedAlertDayModeBackgroundColor,
for: .major, lightingMode: .normal)
mapView.settings.speedometerUIOptions = mutableSpeedometerUIOptions
Objective-C
GMSNavigationMutableSpeedometerUIOptions *mutableSpeedometerUIOptions =
[[GMSNavigationMutableSpeedometerUIOptions alloc] init];
[mutableSpeedometerUIOptions setTextColor: minorSpeedAlertTextColor
forSpeedAlertSeverity: GMSNavigationSpeedAlertSeverityMinor lightingMode:
GMSNavigationLightingModeNormal]; [mutableSpeedometerUIOptions setTextColor:
majorSpeedAlertTextColor forSpeedAlertSeverity:
GMSNavigationSpeedAlertSeverityMajor lightingMode:
GMSNavigationLightingModeNormal]; [mutableSpeedometerUIOptions
setBackgroundColor: minorSpeedAlertNightModeBackgroundColor
forSpeedAlertSeverity: GMSNavigationSpeedAlertSeverityMinor lightingMode:
GMSNavigationLightingModeLowLight]; [mutableSpeedometerUIOptions
setBackgroundColor: majorSpeedAlertDayModeBackgroundColor forSpeedAlertSeverity:
GMSNavigationSpeedAlertSeverityMajor
lightingMode:GMSNavigationLightingModeNormal];
mapView.settings.speedometerUIOptions = mutableSpeedometerUIOptions;
애플리케이션에서 운전자 속도에 관한 정보를 공유해야 하는 경우 Navigation SDK를 사용하여 운전자 속도 정보를 제공할 수도 있습니다.
이는 운전자의 과속을 모니터링하여 안전을 개선하려는 운영자가 있을 수 있는 차량 공유 애플리케이션에 유용할 수 있습니다.
예를 들어 다음 예에서는 속도가 제한 속도를 지정된 비율만큼 초과하는 경우 속도 정보를 공유합니다.
Swift
// Listener method for sharing speed information when the speed exceeds the
speed limit by a specified percentage. #pragma mark GMSNavigatorListener func
navigator(_ navigator : GMSNavigator, didUpdateSpeedingPercentage
percentageAboveLimit : Float) { ... }
Objective-C
// Listener method listening to speeding feed. #pragma mark
GMSNavigatorListener - (void)navigator:(GMSNavigator *)navigator
didUpdateSpeedingPercentage:(float)percentageAboveLimit { ... }
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-31(UTC)
[null,null,["최종 업데이트: 2025-08-31(UTC)"],[[["\u003cp\u003eWhen navigation is in driving mode, the Navigation SDK displays the current speed limit and driver's speed, providing visual and configurable speed alerts.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can customize the thresholds for minor and major speed alerts, including the percentage over the speed limit and duration before triggering.\u003c/p\u003e\n"],["\u003cp\u003eThe speedometer's text and background colors can be customized for day and night modes, allowing for clear visual distinction of speed alert levels.\u003c/p\u003e\n"],["\u003cp\u003eThe Navigation SDK enables access to the driver's speed information, which can be used for purposes like monitoring driver behavior in rideshare applications.\u003c/p\u003e\n"]]],["The Navigation SDK for iOS displays a speed limit and speedometer when driving. Speed alerts are triggered when the driver exceeds the limit. Minor alerts occur at 5 mph (or 10 kph) over, turning the text red. Major alerts occur at 10 mph (or 20 kph) over, turning the background red. Alert thresholds and colors are customizable, including percentages over the limit and time before the alert. The SDK also provides driver speed data for monitoring purposes, such as in rideshare apps.\n"],null,["# Configure speedometer alerts\n\nWhen navigation is enabled and the travel mode is set to driving, the Navigation\nSDK for iOS displays a speed limit control in the lower left corner of the map\nthat shows the current speed limit. If a driver exceeds the speed limit, the\ncontrol expands to display a speedometer next to the speed limit display and\ntriggers alerts when the speed reaches a certain threshold.\n\nBy default, the Navigation SDK triggers a minor speed alert when the driver\nexceeds the speed limit by 5 mph (or 10 kph), and changes the color of the\nspeedometer text to red. It triggers a major speed alert when the driver exceeds\nthe speed limit by 10 mph (or 20 kph), and changes the speedometer background\ncolor to red. \n\nYou can customize both the threshold for triggering the alerts and the text and\nbackground colors the speedometer displays. You can also use the Navigation SDK\nto make the driver's speed information available. For example, you could make\nspeed information available to rideshare operators to help them encourage their\ndrivers to adhere to the speed limit and improve safety.\n\nCustomizing thresholds for speed alerts\n---------------------------------------\n\nYou can customize the speed alert threshold for both minor and major speed\nalerts as a percentage over the speed limit of the current speed. You can also\nspecify how long the threshold is exceeded before the map displays the alert.\n\nThe following code example sets the threshold for a minor speed alert to five\npercent over the speed limit, and the threshold for a major speed alert to 10\npercent over the speed limit. It specifies that the map displays an alert after\nan alert threshold has been exceeded for five seconds.\n\n\u003cbr /\u003e\n\n### Swift\n\n\u003cbr /\u003e\n\n let minorSpeedAlertThresholdPercentage: CGFloat = 0.05 let\n majorSpeedAlertThresholdPercentage: CGFloat = 0.1 let\n severityUpgradeDurationSeconds: TimeInterval = 5\n\n // Configure SpeedAlertOptions let mutableSpeedAlertOptions:\n GMSNavigationMutableSpeedAlertOptions = GMSNavigationMutableSpeedAlertOptions()\n mutableSpeedAlertOptions.setSpeedAlertThresholdPercentage(minorSpeedAlertThresholdPercentage,\n for: .minor)\n mutableSpeedAlertOptions.setSpeedAlertThresholdPercentage(majorSpeedAlertThresholdPercentage,\n for: .major) mutableSpeedAlertOptions.severityUpgradeDurationSeconds =\n severityUpgradeDurationSeconds\n\n // Set SpeedAlertOptions to Navigator. mapView.navigator?.speedAlertOptions =\n mutableSpeedAlertOptions; mapView.navigator?.add(self); // Only needed if\n listening to the delegate events.\n\n\u003cbr /\u003e\n\n### Objective-C\n\n\u003cbr /\u003e\n\n static const CGFloat minorSpeedAlertThresholdPercentage = 0.05; static const\n CGFloat majorSpeedAlertThresholdPercentage = 0.1; static const NSTimeInterval\n severityUpgradeDurationSeconds = 5;\n\n // Configure SpeedAlertOptions GMSNavigationMutableSpeedAlertOptions\n *mutableSpeedAlertOptions = [[GMSNavigationMutableSpeedAlertOptions alloc]\n init]; [mutableSpeedAlertOptions setSpeedAlertThresholdPercentage:\n minorSpeedAlertThresholdPercentage\n forSpeedAlertSeverity:GMSNavigationSpeedAlertSeverityMinor];\n [mutableSpeedAlertOptions\n setSpeedAlertThresholdPercentage:majorSpeedAlertThresholdPercentage\n forSpeedAlertSeverity:GMSNavigationSpeedAlertSeverityMajor];\n [mutableSpeedAlertOptions\n setSeverityUpgradeDurationSeconds:severityUpgradeDurationSeconds];\n\n // Set SpeedAlertOptions to Navigator. mapView.navigator.speedAlertOptions =\n mutableSpeedAlertOptions; [mapView.navigator addListener:self]; // Only needed\n if listening to the delegate events.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nCustomizing how the speedometer displays speed alerts\n-----------------------------------------------------\n\nYou can customize the colors of the speedometer display for each alert level.\n\nThe following table shows the default colors for speed alerts in the\n`GMSNavigationSpeedometerUIOptions` class:\n\n| Element | Color |\n|-----------------------------------------|-----------------|\n| MinorSpeedAlertBackgroundColorDayMode | 0xffffff(white) |\n| MinorSpeedAlertBackgroundColorNightMode | 0x000000 |\n| MinorSpeedAlertTextColorDayMode | 0xd93025 |\n| MinorSpeedAlertTextColorNightMode | 0xd93025 |\n| MajorSpeedAlertBackgroundColorDayMode | 0xd93025 |\n| MajorSpeedAlertBackgroundColorNightMode | 0xd93025 |\n| MajorSpeedAlertTextColorDayMode | 0xffffff(white) |\n| MajorSpeedAlertTextColorNightMode | 0xffffff(white) |\n\nYou can specify the text and background color of the speedometer for both minor\nand major speed alerts:\n\n\u003cbr /\u003e\n\n### Swift\n\n\u003cbr /\u003e\n\n let mutableSpeedometerUIOptions: GMSNavigationMutableSpeedometerUIOptions =\n GMSNavigationMutableSpeedometerUIOptions()\n mutableSpeedometerUIOptions.setTextColor(minorSpeedAlertTextColor, for: .minor,\n lightingMode: .normal)\n mutableSpeedometerUIOptions.setTextColor(majorSpeedAlertTextColor, for: .major,\n lightingMode: .normal)\n mutableSpeedometerUIOptions.setBackgroundColor(minorSpeedAlertNightModeBackgroundColor,\n for: .minor, lightingMode: .lowLight)\n mutableSpeedometerUIOptions.setBackgroundColor(majorSpeedAlertDayModeBackgroundColor,\n for: .major, lightingMode: .normal)\n\n mapView.settings.speedometerUIOptions = mutableSpeedometerUIOptions\n\n\u003cbr /\u003e\n\n### Objective-C\n\n\u003cbr /\u003e\n\n GMSNavigationMutableSpeedometerUIOptions *mutableSpeedometerUIOptions =\n [[GMSNavigationMutableSpeedometerUIOptions alloc] init];\n [mutableSpeedometerUIOptions setTextColor: minorSpeedAlertTextColor\n forSpeedAlertSeverity: GMSNavigationSpeedAlertSeverityMinor lightingMode:\n GMSNavigationLightingModeNormal]; [mutableSpeedometerUIOptions setTextColor:\n majorSpeedAlertTextColor forSpeedAlertSeverity:\n GMSNavigationSpeedAlertSeverityMajor lightingMode:\n GMSNavigationLightingModeNormal]; [mutableSpeedometerUIOptions\n setBackgroundColor: minorSpeedAlertNightModeBackgroundColor\n forSpeedAlertSeverity: GMSNavigationSpeedAlertSeverityMinor lightingMode:\n GMSNavigationLightingModeLowLight]; [mutableSpeedometerUIOptions\n setBackgroundColor: majorSpeedAlertDayModeBackgroundColor forSpeedAlertSeverity:\n GMSNavigationSpeedAlertSeverityMajor\n lightingMode:GMSNavigationLightingModeNormal];\n\n mapView.settings.speedometerUIOptions = mutableSpeedometerUIOptions;\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nReceiving speed information from drivers\n----------------------------------------\n\nIf your application requires sharing information about driver speed, you can\nalso use the Navigation SDK to make the driver's speed information available.\nThis can be useful for rideshare applications in which an operator may want to\nmonitor excessive speeding by drivers to improve safety.\n\nFor example, the following example shares speed information when the speed is a\nspecified percentage over the speed limit:\n\n\u003cbr /\u003e\n\n### Swift\n\n\u003cbr /\u003e\n\n // Listener method for sharing speed information when the speed exceeds the\n speed limit by a specified percentage. #pragma mark GMSNavigatorListener func\n navigator(_ navigator : GMSNavigator, didUpdateSpeedingPercentage\n percentageAboveLimit : Float) { ... }\n\n\u003cbr /\u003e\n\n### Objective-C\n\n\u003cbr /\u003e\n\n // Listener method listening to speeding feed. #pragma mark\n GMSNavigatorListener - (void)navigator:(GMSNavigator *)navigator\n didUpdateSpeedingPercentage:(float)percentageAboveLimit { ... }\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e"]]