बाधाओं की रीयल-टाइम जानकारी पाने की सुविधा कॉन्फ़िगर करना
रीयल-टाइम में होने वाली रुकावटों की जानकारी देने वाली सुविधाओं का मकसद, उपयोगकर्ताओं को उनके रास्ते में आने वाली रुकावटों के बारे में सूचना देना है. साथ ही, उपयोगकर्ताओं को उन रुकावटों की शिकायत करने और उनकी पुष्टि करने की सुविधा देना है. सड़क पर होने वाली रुकावटों के उदाहरणों में ये शामिल हैं: वाहन दुर्घटनाएं, ट्रैफ़िक जाम, पुलिस और स्पीड कैमरे की मौजूदगी, निर्माण कार्य, लेन बंद होना, और मौसम की कुछ स्थितियां. इस पेज पर, रीयल-टाइम में रुकावट की जानकारी देने वाली सुविधाओं और उन्हें कॉन्फ़िगर करने के विकल्पों के बारे में बताया गया है. इसमें उन ऐप्लिकेशन के बारे में भी बताया गया है जो कस्टम नेविगेशन यूज़र इंटरफ़ेस (यूआई) का इस्तेमाल करते हैं.
बाधा की जानकारी देने वाली रीयल-टाइम सुविधाएं
Navigation SDK टूल में, नेविगेशन की मुख्य सुविधा के तौर पर, रीयल-टाइम में रुकावटों की जानकारी देने वाली ये सुविधाएं शामिल हैं:- रास्तों पर इंटरैक्टिव डिसरप्शन कॉलआउट.
- नेविगेशन के दौरान, सड़क बंद होने की सूचनाएं अपने-आप मिलती हैं और वोटिंग की सुविधा भी मिलती है.
- नेविगेशन के दौरान, रास्ते में आने वाली रुकावटों की जानकारी देना.
इन सुविधाओं को कॉन्फ़िगर किया जा सकता है. ये डिफ़ॉल्ट रूप से चालू रहती हैं. यहां दिए गए सेक्शन में, सुविधाओं और कॉन्फ़िगरेशन के उपलब्ध विकल्पों के बारे में ज़्यादा जानकारी दी गई है.
रास्तों पर रुकावटों के बारे में इंटरैक्टिव कॉलआउट
जब कोई ऐप्लिकेशन, रास्ते की खास जानकारी या नेविगेशन के दौरान कोई रास्ता दिखाता है, तो रास्ते में आने वाली मौजूदा रुकावटें, रास्ते के साथ कॉलआउट के तौर पर दिखती हैं. कॉलआउट में एक आइकॉन शामिल होता है. इससे पता चलता है कि किस तरह की रुकावट आई है.

shouldDisplayPrompts
का इस्तेमाल करके, रास्ते में आने वाली रुकावटों के बारे में बताने वाले कॉलआउट के दिखने की सुविधा को कंट्रोल किया जा सकता है. इससे किसी रुकावट के पास पहुंचने पर, अपने-आप दिखने वाली सूचनाओं को भी कंट्रोल किया जा सकता है.
mapView.navigator.shouldDisplayPrompts = true
जब कोई उपयोगकर्ता कॉलआउट पर टैप करता है, तो उसे रुकावट की जानकारी दिखाएं
उपयोगकर्ता, कॉलआउट पर टैप करके जानकारी देने वाला कार्ड देख सकते हैं. इसमें रुकावट के बारे में ज़्यादा जानकारी होती है. जैसे, रुकावट किस तरह की है, इसे आखिरी बार कब रिपोर्ट किया गया था. कुछ मामलों में, यह वोट करने का विकल्प भी होता है कि रुकावट अब भी मौजूद है या नहीं. दो तरह के जानकारी वाले कार्ड दिख सकते हैं. ये इस बात पर निर्भर करते हैं कि उपयोगकर्ता नेविगेशन का इस्तेमाल कर रहा है या नहीं. साथ ही, हर टाइप के लिए कॉन्फ़िगरेशन के विकल्प अलग-अलग होते हैं.
नेविगेशन शुरू करने से पहले, रास्ते की खास जानकारी देने वाले कॉलआउट सूचना कार्ड
जब कोई उपयोगकर्ता, ऐक्टिव नेविगेशन शुरू करने से पहले, रास्ते की खास जानकारी पर मौजूद कॉलआउट पर टैप करता है, तो उसे एक सूचना कार्ड दिखता है. इसमें रुकावट के बारे में ज़्यादा जानकारी होती है.

showsIncidentCards
का इस्तेमाल करके, यह कंट्रोल किया जा सकता है कि उपयोगकर्ता, रास्ते की खास जानकारी में दिखने वाले रुकावट के कॉलआउट पर टैप करके ज़्यादा जानकारी देख पाएं या नहीं.
mapView.settings.showsIncidentCards = true
नेविगेशन के दौरान कॉलआउट की जानकारी वाले कार्ड
नेविगेशन के दौरान किसी रास्ते पर रुकावट की जानकारी देने वाला कॉलआउट दिखने पर, उपयोगकर्ता उस पर टैप कर सकते हैं. ऐसा करने पर, उन्हें रुकावट के बारे में ज़्यादा जानकारी देने वाला कार्ड दिखेगा. इसमें रुकावट की वजह, आखिरी बार इसकी रिपोर्ट किए जाने का समय, और यह रुकावट अब भी मौजूद है या नहीं, इस बारे में वोट करने के बटन शामिल होंगे. उपयोगकर्ताओं के सबमिट किए गए वोट को Google प्रोसेस करता है. साथ ही, इन्हें Google Maps और Navigation SDK इस्तेमाल करने वाले अन्य लोगों के लिए मैप पर दिखाया जा सकता है. इनका इस्तेमाल यह तय करने के लिए भी किया जाता है कि रुकावट की जानकारी दिखानी है या नहीं.

नेविगेशन के दौरान, रुकावट की जानकारी देने वाले कॉलआउट के दिखने और उन पर टैप किए जाने की सुविधा को कंट्रोल किया जा सकता है. इसके लिए, shouldDisplayPrompts
का इस्तेमाल करें. इससे रास्ते के साथ-साथ कॉलआउट दिखने और किसी रुकावट के पास पहुंचने पर, अपने-आप सूचनाएं दिखने की सुविधा को भी कंट्रोल किया जा सकता है.
mapView.navigator.shouldDisplayPrompts = true
नेविगेशन के दौरान, रास्ते में आने वाली रुकावटों के बारे में अपने-आप सूचनाएं पाने और वोट करने की सुविधा
नेविगेशन चालू होने के दौरान, जब कोई व्यक्ति रास्ते में किसी रुकावट के पास पहुंचता है, तो उसे एक प्रॉम्प्ट दिखता है. इसमें रुकावट के बारे में जानकारी होती है. साथ ही, यह वोट करने के लिए बटन होते हैं कि क्या रुकावट अब भी मौजूद है. उपयोगकर्ताओं के सबमिट किए गए वोटों को Google प्रोसेस करता है. साथ ही, इन्हें Google Maps और Navigation SDK इस्तेमाल करने वाले अन्य लोगों के लिए मैप पर दिखाया जा सकता है. इनका इस्तेमाल यह तय करने के लिए भी किया जाता है कि रुकावट की जानकारी दिखानी है या नहीं.

नेविगेशन चालू होने के दौरान, सूचना वाले प्रॉम्प्ट के दिखने की सुविधा को कॉन्फ़िगर किया जा सकता है. इसके लिए, shouldDisplayPrompts
का इस्तेमाल करें. इससे रास्तों पर कॉलआउट के दिखने की सुविधा भी कंट्रोल होती है.
mapView.navigator.shouldDisplayPrompts = true
नेविगेशन के दौरान, रास्ते में आने वाली रुकावटों की जानकारी देना
ऐक्टिव नेविगेशन मोड के दौरान, नेविगेशन यूज़र इंटरफ़ेस (यूआई) पर एक बटन दिखता है. इसकी मदद से, उपयोगकर्ता अपने रास्ते में आने वाली नई समस्याओं की शिकायत कर सकते हैं. जब कोई उपयोगकर्ता बटन पर टैप करता है, तो उसे एक मेन्यू दिखता है. इसमें रुकावट की उन सभी तरह की समस्याओं की जानकारी होती है जिनकी शिकायत की जा सकती है. उपयोगकर्ताओं की ओर से सबमिट की गई रिपोर्ट को Google प्रोसेस करता है. साथ ही, इन्हें Google Maps और Navigation SDK का इस्तेमाल करने वाले अन्य लोगों के लिए मैप पर दिखाया जा सकता है.


स्टैंडर्ड रिपोर्टिंग बटन दिखाना या छिपाना
navigationReportIncidentButtonEnabled
का इस्तेमाल करके, नेविगेशन चालू होने के दौरान स्टैंडर्ड रिपोर्टिंग बटन की दृश्यता को कॉन्फ़िगर किया जा सकता है.
// Enables the incident reporting FAB to show in situations where incident // reporting is possible. mapView.settings.navigationReportIncidentButtonEnabled = true
कस्टम रिपोर्टिंग बटन जोड़ना
स्टैंडर्ड डिसरप्शन रिपोर्टिंग बटन की जगह, नेविगेशन यूज़र इंटरफ़ेस (यूआई) में कस्टम रिपोर्टिंग बटन जोड़ा जा सकता है. जब उपयोगकर्ता कस्टम बटन पर क्लिक करता है, तब 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. } }
कस्टम नेविगेशन यूज़र इंटरफ़ेस (यूआई) के साथ काम करना
अगर आपने Navigation SDK टूल को लागू करते समय कस्टम यूज़र इंटरफ़ेस (यूआई) एलिमेंट शामिल किए हैं, तो आपको टकराव से बचने के लिए, रीयल-टाइम में होने वाली रुकावटों के एलिमेंट को ध्यान में रखना होगा.
रिपोर्टिंग बटन की पोज़िशन
डिफ़ॉल्ट रूप से, रुकावट की जानकारी देने वाला बटन, मैप के सबसे नीचे/आखिरी कोने में होता है. बाईं से दाईं ओर लिखी जाने वाली भाषाओं के लिए, यह बटन दाईं ओर होता है. वहीं, दाईं से बाईं ओर लिखी जाने वाली भाषाओं के लिए, यह बटन बाईं ओर होता है. अगर आपको कस्टम यूज़र इंटरफ़ेस (यूआई) एलिमेंट के लिए जगह बनाने के लिए, रिपोर्टिंग बटन को दूसरी जगह ले जाना है, तो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;
Prompt Visibility API (Experimental)
Prompt Visibility API की मदद से, Navigation SDK से जनरेट हुए यूआई एलिमेंट और आपके कस्टम यूआई एलिमेंट के बीच होने वाले टकरावों से बचा जा सकता है. इसके लिए, यह एपीआई एक लिसनर जोड़ता है. इससे Navigation SDK का यूआई एलिमेंट दिखने से पहले और जैसे ही एलिमेंट हटता है, आपको कॉलबैक मिलता है. आपको रीयल-टाइम में रुकावट की जानकारी देने वाले एलिमेंट के लिए, कॉलबैक मिल सकते हैं. इनमें जानकारी देने वाले कार्ड, प्रॉम्प्ट, और रुकावट की जानकारी देने वाला मेन्यू शामिल है. साथ ही, आपको 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. } ...