নেভিগেশন চালু করা থাকলে এবং ভ্রমণ মোড ড্রাইভিংয়ে সেট করা থাকলে, iOS-এর জন্য Navigation SDK ম্যাপের নিচের বাঁদিকের কোণে স্পিড লিমিট কন্ট্রোল দেখায় যা বর্তমান স্পিড লিমিট দেখায়। কোনও ড্রাইভার স্পিড লিমিট অতিক্রম করলে, কন্ট্রোলটি স্পিড লিমিট ডিসপ্লের পাশে একটি স্পিডোমিটার দেখানোর জন্য প্রসারিত হয় এবং গতি একটি নির্দিষ্ট থ্রেশহোল্ডে পৌঁছালে সতর্কতা ট্রিগার করে।
ডিফল্ট হিসেবে, ড্রাইভার গতিসীমা ৫ মাইল প্রতি ঘণ্টা (বা ১০ কিমি প্রতি ঘণ্টা) অতিক্রম করলে, Navigation SDK একটি ছোট স্পিড অ্যালার্ট ট্রিগার করে এবং স্পিডোমিটার টেক্সটের রঙ পরিবর্তন করে লাল করে দেয়। ড্রাইভার ১০ মাইল (বা ২০ কিমি) বেশি গতিতে গাড়ি চালালে এটি একটি বড় স্পিড অ্যালার্ট ট্রিগার করে এবং স্পিডোমিটারের ব্যাকগ্রাউন্ডের রঙ লাল করে দেয়।
আপনি অ্যালার্ট ট্রিগার করার থ্রেশহোল্ড এবং স্পিডোমিটারের দেখানো টেক্সট ও ব্যাকগ্রাউন্ডের রঙ, দুটিই কাস্টমাইজ করতে পারবেন। এছাড়াও, আপনি ড্রাইভারের গতি সংক্রান্ত তথ্য উপলভ্য করতে Navigation SDK ব্যবহার করতে পারেন। যেমন, আপনি রাইডশেয়ার অপারেটরদের জন্য স্পিড সংক্রান্ত তথ্য উপলভ্য করতে পারেন যাতে তারা তাদের ড্রাইভারদের স্পিড সীমা মেনে চলতে এবং নিরাপত্তা উন্নত করতে উৎসাহিত করতে পারে।
স্পিড অ্যালার্টের জন্য থ্রেশহোল্ড কাস্টমাইজ করা
আপনি মাইনর ও মেজর স্পিড অ্যালার্টের জন্য স্পিড অ্যালার্ট থ্রেশহোল্ড কাস্টমাইজ করতে পারবেন। এটি বর্তমান স্পিডের স্পিড লিমিটের শতাংশ হিসেবে দেখানো হয়। এছাড়াও, ম্যাপে সতর্কতা দেখানোর আগে কতক্ষণ ধরে থ্রেশহোল্ড অতিক্রম করা হয়েছে তা আপনি নির্দিষ্ট করতে পারবেন।
নিম্নলিখিত কোডের উদাহরণটি স্পিড লিমিটের পাঁচ শতাংশ বেশি হলে ছোটখাটো স্পিড অ্যালার্টের থ্রেশহোল্ড সেট করে এবং স্পিড লিমিটের ১০ শতাংশ বেশি হলে বড় স্পিড অ্যালার্টের থ্রেশহোল্ড সেট করে। এটি নির্দিষ্ট করে যে ম্যাপটি পাঁচ সেকেন্ডের জন্য সতর্কতা থ্রেশহোল্ড অতিক্রম করার পরে একটি সতর্কতা প্রদর্শন করে।
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(white) |
| 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 { ... }