سوالات متداول
جزئیات محصول
- اطلاعیه شرایط خدمات SDK ناوبری چگونه باید نمایش داده شود؟
- راهنمای صوتی از چه زبانهایی پشتیبانی میکند؟
- آیا وقتی راننده از حالت ناوبری خارج میشود، جهتیابی حفظ میشود؟
- آیا خطوط چندخطی هنگام شروع یا تغییر مسیر در دسترس هستند؟
- آیا کاربران اپلیکیشن باید نقشه گوگل را روی موبایل نصب کرده باشند؟
- آیا SDK ناوبری میتواند پارکینگهای نزدیک رستورانها و سایر مقاصد را شناسایی کند؟
- آیا SDK ناوبری هنگام نزدیک شدن به یک نقطه پیچ، جهت ترافیک را در خطوط نشان میدهد؟
مسائل
- در Xcode 12، برنامهها به درستی برای شبیهساز ساخته نمیشوند. چگونه میتوانم این مشکل را برطرف کنم؟
-
GMSMapViewبارگذاری نمیشود.
شبکه
- کیت توسعه نرمافزار ناوبری (Navigation SDK) چگونه اتصال ضعیف را مدیریت میکند؟
- آیا حالت آفلاین در دسترس است؟
دادهها
- آیا میتوانم قبل از شروع مسیر، تمام توقفها/مقصدهای یک سفر را بازیابی کنم؟
- آیا راهنمای مسیر گام به گام در ابتدای مسیر موجود است؟
- زمان تخمینی رسیدن (ETA) چگونه به کاربران برنامه اطلاع داده میشود؟
- آیا میتوان از
RoadSnappedLocationProviderبرای به دست آوردن موقعیت مکانی فعلی راننده در صورتی که ناوبری در پیشزمینه نباشد، استفاده کرد؟ - آیا SDK ناوبری از تعیین محدوده جغرافیایی (geofencing) پشتیبانی میکند؟
- آیا میتوانم اعلانها را وقتی برنامه ناوبری در پسزمینه است غیرفعال کنم؟
شخصیسازی رابط کاربری
- آیا میتوانم بهترین گزینه مسیر را با رنگ مشخص کنم؟
- آیا SDK ناوبری میتواند زمان تقریبی رسیدن به مقصد نهایی را نشان دهد؟
- چگونه میتوانم بهروزرسانیهای ETA را پنهان کنم؟
- چه سفارشیسازیهایی برای رابط کاربری کارتهای سربرگ و پاصفحه در دسترس است؟
مسیریابی
- آیا میتوانم یک مسیر خاص را به راننده ارائه دهم یا مسیرهای جایگزین را حذف کنم؟
- آیا میتوانم برچسبی متفاوت از مکان پیشفرض مقصد به راننده نشان دهم؟
- آیا میتوانم از کیت توسعه نرمافزار ناوبری (Navigation SDK) برای ردیابی انحرافات از یک مسیر تعریفشده استفاده کنم؟
- آیا راننده میتواند بدون تکمیل مسیر از ناوبری خارج شود؟
شبیهساز
گردشهای کاری
خدمات حمل و نقل
- استفاده از کیت توسعه نرمافزار ناوبری (Navigation SDK) چه تفاوتی برای مشتریان سرویسهای موبایل (Mobility Services) دارد؟
- چگونه میتوانم تشخیص دهم که آیا مشتری خدمات حمل و نقل هستم؟
- هزینهی خدمات ناوبری (Navigation SDK) برای مشتریان خدمات حمل و نقل (Mobility Services) چگونه محاسبه میشود؟
- کدام APIهای SDK ناوبری فقط باید توسط مشتریان سرویسهای تحرکپذیری استفاده شوند؟
- اگر من مشتری سرویسهای موبایلی باشم، آیا میتوانم از پیادهسازی SDK ناوبری که مربوط به سرویسهای موبایلی نیست نیز استفاده کنم؟
جزئیات محصول
- برنامه شما باید یک پنجره محاورهای با اطلاعیه شرایط خدمات Navigation SDK پیادهسازی کند که هر راننده باید آن را بپذیرد. این پنجره محاورهای به راننده فرصت میدهد تا با شرایط خدمات موافقت کند. یک فایل متنی از این شرایط به همراه Navigation SDK ارائه میشود.
- در اندروید، از متد
NavigationApi.showTermsAndConditionsDialogبرای نمایش کادر محاورهای حاوی شرایط استفاده کنید. - در iOS، تابع
GMSNavigationServices.showTermsAndConditionsDialogIfNeededWithCompanyNameرا فراخوانی کنید. - هر زبانی که توسط Google Maps Mobile پشتیبانی شود، به طور خودکار برای Navigation SDK در دسترس است. یک دستگاه دارای یک زبان سیستمی پیشفرض است و یک برنامه نمیتواند آن تنظیم را تغییر دهد؛ با این حال، برنامه به بیش از ۷۰ زبان دسترسی دارد.
بله. در اندروید، پس از شروع،
LocationListenerبه اجرا در پسزمینه ادامه میدهد. برنامه شما به ثبت موقعیت مکانی و حفظ جهت ادامه میدهد.در iOS، برای ادامه دریافت بهروزرسانیهای موقعیت مکانی و جهتیابی در پسزمینه، road snapping را پیادهسازی کنید و
allowsBackgroundLocationUpdatesرویYESتنظیم کنید.بله. وقتی یک مسیر ایجاد یا تغییر میکند،
RouteChangeListenerچندخطیها را ارائه میدهد.- خیر، کیت توسعه نرمافزار ناوبری (Navigation SDK) نیازی به نصب گوگل مپ موبایل روی دستگاه ندارد.
- خیر، در حال حاضر Navigation SDK این قابلیت را ارائه نمیدهد.
- بله. جهت ترافیک به صورت پیشفرض در دسترس و نمایش داده میشود.
مسائل
- در Xcode 12، برنامهها به درستی برای شبیهساز ساخته نمیشوند. چگونه میتوانم این مشکل را برطرف کنم؟
برای رفع این مشکل، تنظیمات ساخت پروژه Xcode خود را باز کنید و
arm64فقط برای ساختهای "iOS Simulator" بهExcluded Architecturesاضافه کنید.برای اطلاعات بیشتر، به تاپیک StackOverflow زیر مراجعه کنید.
- GMSMapView بارگذاری نمیشود.
اگر GMSMapView بارگذاری نشد:
- بررسی کنید که NavSDK در Cloud Console فعال باشد.
- اگر Nav SDK نصب شده است، اما پروژه شما از APIهای Nav SDK استفاده نمیکند، آن را از فایل باینری خود حذف کنید.
شبکه
- کیت توسعه نرمافزار ناوبری (Navigation SDK) چگونه اتصال ضعیف را مدیریت میکند؟
- کیت توسعه نرمافزار ناوبری (Navigation SDK) مسیر هر سفر را از قبل ذخیره میکند. اطلاعات از پیش ذخیره شده شامل اطلاعات مسیریابی به مدت ۱۵ تا ۲۰ دقیقه و مسیرهای جایگزین در صورتی که راننده از مسیر منحرف شود، میباشد. کیت توسعه نرمافزار ناوبری (Navigation SDK) با استفاده از GPS و حسگرهای دستگاه، موقعیت تقریبی را تعیین میکند.
- آیا حالت آفلاین در دسترس است؟
- خیر، کیت توسعه نرمافزار ناوبری (Navigation SDK) در حال حاضر حالت آفلاین ارائه نمیدهد؛ با این حال، این کیت، اطلاعات از پیش ذخیرهشده برای یک سفر را ارائه میدهد.
دادهها
- آیا میتوانم قبل از شروع مسیر، تمام توقفها/مقصدهای یک سفر را بازیابی کنم؟
بله. در اندروید، برای بازیابی مسیرهای یک مسیر، تابع
Navigator.getRouteSegments()را فراخوانی کنید.در iOS، تابع
GMSNavigator.routeLegs(read)را فراخوانی کنید.- آیا راهنمای مسیر گام به گام در ابتدای مسیر موجود است؟
- بله. کیت توسعه نرمافزار ناوبری (Navigation SDK) فهرستی از بخشهای مسیر را ارائه میدهد. علاوه بر این، راننده میتواند با کشیدن انگشت خود روی کارت مسیر در بالای صفحه، هر مانور را مشاهده کند.
- چگونه ETA به کاربران برنامه اطلاع داده میشود؟
در اندروید، از مراحل زیر برای ارائه اطلاعات ETA به کاربران برنامه استفاده کنید:
- با استفاده از
Navigator.getTimeAndDistanceList()زمان و مسافت را برای همه نقاط مسیر بازیابی کنید. - این اطلاعات را همانطور که برای زمان رسیدن به مقصد راننده انجام میدهید، به برنامه کلاینت نیز ارسال کنید.
در iOS، از این مراحل برای ارائه اطلاعات ETA به کاربران برنامه استفاده کنید:
- با استفاده از
Navigator.getRouteSegments()مسیرهای موجود در مسیر را بازیابی کنید. - برای هر مرحله از سفر، تابع
GMSNavigator.timeToNextDestinationرا فراخوانی کنید. - همانطور که برای زمان رسیدن به مقصد راننده (ETA) انجام میدهید، اطلاعات زمان را به برنامه کلاینت ارسال کنید.
- با استفاده از
- آیا میتوان از
RoadSnappedLocationProviderبرای به دست آوردن موقعیت مکانی فعلی راننده در صورتی که ناوبری در پیشزمینه نباشد، استفاده کرد؟ بله. در اندروید،
RoadSnappedLocationProviderبه طور پیشفرض در پسزمینه اجرا میشود.در iOS، برای اینکه ناوبری در پسزمینه اجرا شود، شنونده (listener) را برای
GMSRoadSnappedLocationProviderListenerپیادهسازی کنید و ویژگیallowsBackgroundLocationUpdatesرا رویTRUEتنظیم کنید.- آیا SDK ناوبری از تعیین محدوده جغرافیایی (geofencing) پشتیبانی میکند؟
خیر. در زمینه ناوبری،
remainingTimeOrdistanceChangeListenerنسبت به geofence مزیت دارد. geofence ممکن است هندسه جاده را در نظر نگیرد و ممکن است دقیقاً روی نقطهای که راننده در حال پیمایش است، متمرکز نباشد.شما میتوانید این قابلیت را با استفاده از
remainingTimeOrdistanceChangeListenerتقریب بزنید.- آستانه را برای تعیین فراوانی فراخوانیهای مجدد تنظیم کنید.
- مسافت باقی مانده تا مقصد را بررسی کنید.
برای مثال، اگر آستانه را روی ۱۰۰ متر تنظیم کنید، وقتی فاصله تا مقصد ۱۰۰ متر تغییر کند، یک تماس مجدد دریافت خواهید کرد. با کاهش فاصله، میتوانید این آستانه را به مقدار کمتری بهروزرسانی کنید و تماسهای مجدد بیشتری دریافت کنید. سپس، فاصله باقیمانده را بررسی کنید تا مشخص شود که آیا به اندازه کافی به محل تحویل/تحویل نزدیک هستید یا خیر.
در iOS، شنونده
GMSNavigatorListener.didUpdateRemainingDistanceرا برای مدیریت فاصله بین اعلانها پیادهسازی کنید.- آیا میتوانم اعلانها را وقتی برنامه ناوبری در پسزمینه است غیرفعال کنم؟
بله. در اندروید، از
Navigator.setHeadsUpNotificationEnabledبرای کنترل اعلانها استفاده کنید. این متد یک آرگومان بولی دارد.FALSEاعلانها را غیرفعال میکند؛TRUEاعلانها را فعال میکند.در iOS، با تنظیم
GMSRoadSnappedLocationProvider.allowsBackgroundLocationUpdatesروی NO، اعلانهای پسزمینه را برای مکانهای ثبتشده در جاده غیرفعال کنید.برای غیرفعال کردن پردازش پسزمینه برای سایر اعلانهای موقعیت مکانی، تابع
GMSNavigator.sendsBackgroundNotifications(NO)را فراخوانی کنید.
شخصیسازی رابط کاربری
- آیا میتوانم بهترین گزینه مسیر را با رنگ مشخص کنم؟
- خیر. در حال حاضر امکان رنگآمیزی یک مسیر خاص پشتیبانی نمیشود.
- آیا SDK ناوبری میتواند زمان تقریبی رسیدن به مقصد نهایی را نشان دهد؟
بله. در اندروید، از روشهای زیر استفاده کنید:
- با استفاده از
Navigator.getTimeAndDistanceList()زمان و مسافت را برای همه نقاط مسیر بازیابی کنید. - با استفاده از
NavigationFragment.setEtaCardEnabled(false)زمان رسیدن به نقطهی مسیر فعلی را مخفی کنید. - زمان تقریبی رسیدن به مقصد نهایی را رندر کنید.
در iOS از موارد زیر استفاده کنید:
- تابع
GMSNavigator.routeLegs(read)را فراخوانی میکند. - در آخرین مرحله،
GMSNavigator.timeToNextDestinationرا فراخوانی کنید. - با استفاده از
MSMapView.settings.navigationFooterEnabled=NOتا FALSE، زمان تقریبی رسیدن به نقطهی مسیر فعلی را مخفی کنید. - زمان تقریبی رسیدن به مقصد نهایی را رندر کنید.
- با استفاده از
- چگونه میتوانم بهروزرسانیهای ETA را پنهان کنم؟
شما میتوانید کارتهای ETA را با روشهای زیر غیرفعال کنید:
- در اندروید، از
navigationView.setEtaCardEnabled(false)استفاده کنید. - در iOS، از
GMSMapView.settings.navigationFooterEnabled=NOاستفاده کنید.
- در اندروید، از
در اندروید، از
StylingOptionsبرای تنظیم سبک رنگ پسزمینه استفاده میشود. برای پنهان کردن یا نمایش دادن سرصفحه و پاصفحه، از توابع عضوsetHeaderEnabledوsetFooterEnabledازNavigationFragmentاستفاده کنید.در iOS، از
GMSMapView.settings.navigationHeaderPrimaryBackgroundColorبرای تنظیم استایل رنگ پسزمینه استفاده کنید. برای پنهان کردن یا نمایش دادن سرصفحه و پاصفحه از ویژگیهایnavigationFooterEnabledوnavigationHeaderEnabledازGMSUISettingsاستفاده کنید.
مسیریابی
- آیا میتوانم یک مسیر خاص را به راننده ارائه دهم یا مسیرهای جایگزین را حذف کنم؟
- خیر. به طور پیشفرض، چندین مسیر ارائه میشود و سریعترین مسیر اولویت دارد. میتوانید با اضافه کردن تنظیمات برگزیده، مانند «اجتناب از بزرگراهها و عوارضیها»، به درخواست خود، مسیر پیشفرض را تغییر دهید. اضافه کردن نقاط مسیر نیز بر مسیر تأثیر میگذارد.
- آیا میتوانم به کاربر برنامه برچسبی متفاوت از مکان پیشفرض مقصد نشان دهم؟
بله. در اندروید، یک
Markerبا عنوان دلخواه برای مقصد و طول و عرض جغرافیایی ایجاد کنید. کیت توسعه نرمافزار ناوبری (Navigation SDK) عنوان دلخواه و مختصات را رویNavigationMapنمایش میدهد.در iOS، شما یک
GMSMarkerبرای مقصد ایجاد و نمایش میدهید.- آیا میتوانم از کیت توسعه نرمافزار ناوبری (Navigation SDK) برای ردیابی انحرافات از یک مسیر تعریفشده استفاده کنم؟
بله. در اندروید، از
Navigator.setRouteChangedListenerبرای دریافت اعلانها هنگام تغییر مسیر یا توصیه مسیر جدید استفاده کنید:- یک شنونده (listener) ثبت کنید که موقعیت دستگاه را در طول مسیر با استفاده از متد
Navigator.setRouteChangedListenerبررسی کند. - کد را به رویداد فراخوانی (callback event handler)،
onRouteChanged، اضافه کنید:- ارسال پیام به کاربر برنامه با اطلاعات بهروز شده ETA و فاصله.
- مکان دستگاه را ردیابی کنید.
- [اختیاری] سایر قابلیتهای مورد نیاز برنامه خود را برای مدیریت زمانی که راننده از مسیر تعیینشده خارج شده است، اضافه کنید.
در iOS، از
GMSNavigatorو شنوندههای آن برای دریافت اعلانها هنگام تغییر مسیر یا توصیه مسیر جدید استفاده کنید:- در کنترلر نمای نقشه، پروتکل
GMSNavigatorListenerو پروتکلGMSRoadSnappedLocationProviderListenerرا پیادهسازی کنید. - پیادهسازی
GMSNavigatorListener.navigatorDidChangeRoute - با استفاده از ویژگیهای
routeLegsوcurrentRouteLegازGMSNavigatorبه مسیر جدید دسترسی پیدا کنید.
- یک شنونده (listener) ثبت کنید که موقعیت دستگاه را در طول مسیر با استفاده از متد
بله. در اندروید، برای متوقف کردن ناوبری، متد
Navigator.stopGuidance()را فراخوانی کنید.در iOS،
GMSNavigator.clearDestinationsرا فراخوانی کنید.
شبیهساز
- آیا شبیهساز از تغییر مسیر پشتیبانی میکند؟
بله. در اندروید، برای شبیهسازی سفری که شامل تغییر مسیر است، تابع
simulateLocationsAlongNewRouteرا فراخوانی کنید. متدsimulateLocationsAlongExistingRouteتغییرات مسیر موجود را نادیده میگیرد.در iOS، از
GMSLocationSimulator.simulateAlongNewRouteToDestinationsبرای شبیهسازی سفری که شامل تغییر مسیر است استفاده کنید. اگر هیچ تغییری در مسیر پیشبینی نمیکنید، میتوانید ازGMSLocationSimulator.simulateLocationsAlongExistingRouteیاGMSLocationSimulator.simulateAlongNewRouteToDestinationsاستفاده کنید.
گردشهای کاری
- چگونه میتوانم پس از بستن یک اکتیویتی که حاوی یک قطعه ناوبری است، اعلان را رد کنم؟
اعلان ناوبری در طول ناوبری، زمانی که فعالیت بسته میشود، قابل مشاهده باقی میماند. وقتی وسیله نقلیه به مقصد میرسد، ناوبری متوقف میشود و اعلان ناپدید میشود.
برای مدیریت کلیکها روی اعلان، از
Navigator.startGuidance(intent resumeIntent)استفاده کنید.resume intentزمانی فعال میشود که کاربر برنامه روی اعلان کلیک کند. معمولاًNavigator.startguidance(getIntent())از Activity اصلی فراخوانی میشود که وقتی کاربر برنامه روی اعلان کلیک میکند، Activity را فراخوانی میکند.
خدمات حمل و نقل
سرویسهای تحرک پلتفرم نقشههای گوگل مجموعهای از APIها و SDKها را برای کمک به پشتیبانی از نیازهای سازمانی برای کسبوکارهای حملونقل و لجستیک ارائه میدهند. برای مشتریان سرویسهای تحرک، SDK ناوبری معمولاً همراه با سرویسهای مرتبط برای بهینهسازی مسیر، ارسال، ردیابی وظایف، تجزیه و تحلیل ناوگان و موارد دیگر استفاده میشود. SDK ناوبری همچنین برای مشتریان سرویسهای تحرک به صورت متفاوتی محاسبه میشود. برای اطلاعات بیشتر، به مستندات سرویسهای تحرک مراجعه کنید.
محصولات مربوط به حمل و نقل فقط برای مشتریان منتخب در دسترس هستند. برای اطلاعات بیشتر با نماینده فروش خود تماس بگیرید.
ReportBillableEvent در کد خود باشید. فقط مشتریان خدمات تحرک باید متد ReportBillableEvent فراخوانی کنند.چندین API در کیت توسعه نرمافزار ناوبری (Navigation SDK) وجود دارد که فقط برای استفاده مشتریان سرویسهای موبایلی (Mobility Services) در نظر گرفته شدهاند و گوگل برای آنها بر اساس هر تراکنش هزینه دریافت میکند. اگر شما مشتری سرویسهای موبایلی نیستید، روشهای زیر بیفایده هستند:
بله، مشتریان سرویسهای موبایلی میتوانند از هر دو پیادهسازی سرویسهای موبایلی و غیرموبایلیِ Navigation SDK استفاده کنند. با این حال، شما فقط میتوانید از یک نوع پیادهسازی در یک برنامه در یک زمان استفاده کنید. همچنین باید یک پروژه Google Cloud جدید، حساب پرداخت و کلید API ایجاد کنید، جدا از مواردی که با پیادهسازی سرویسهای موبایلی خود استفاده میکنید. برای اطلاعات بیشتر، به مرور کلی تنظیمات Navigation SDK مراجعه کنید.
برای اطلاعات بیشتر در مورد استفاده از پیادهسازی SDK ناوبری بدون سرویسهای حرکتی، از جمله انتقال برنامه از یک نوع پیادهسازی به نوع دیگر، با نماینده حساب گوگل خود تماس بگیرید.
توجه: اگر مشتری سرویسهای تحرک نیستید و علاقهمند به کسب اطلاعات بیشتر در مورد مجموعه APIها و SDKهای سرویسهای تحرک هستید، با بخش فروش پلتفرم نقشههای گوگل تماس بگیرید .
سوالات متداول
جزئیات محصول
- اطلاعیه شرایط خدمات SDK ناوبری چگونه باید نمایش داده شود؟
- راهنمای صوتی از چه زبانهایی پشتیبانی میکند؟
- آیا وقتی راننده از حالت ناوبری خارج میشود، جهتیابی حفظ میشود؟
- آیا خطوط چندخطی هنگام شروع یا تغییر مسیر در دسترس هستند؟
- آیا کاربران اپلیکیشن باید نقشه گوگل را روی موبایل نصب کرده باشند؟
- آیا SDK ناوبری میتواند پارکینگهای نزدیک رستورانها و سایر مقاصد را شناسایی کند؟
- آیا SDK ناوبری هنگام نزدیک شدن به یک نقطه پیچ، جهت ترافیک را در خطوط نشان میدهد؟
مسائل
- در Xcode 12، برنامهها به درستی برای شبیهساز ساخته نمیشوند. چگونه میتوانم این مشکل را برطرف کنم؟
-
GMSMapViewبارگذاری نمیشود.
شبکه
- کیت توسعه نرمافزار ناوبری (Navigation SDK) چگونه اتصال ضعیف را مدیریت میکند؟
- آیا حالت آفلاین در دسترس است؟
دادهها
- آیا میتوانم قبل از شروع مسیر، تمام توقفها/مقصدهای یک سفر را بازیابی کنم؟
- آیا راهنمای مسیر گام به گام در ابتدای مسیر موجود است؟
- زمان تخمینی رسیدن (ETA) چگونه به کاربران برنامه اطلاع داده میشود؟
- آیا میتوان از
RoadSnappedLocationProviderبرای به دست آوردن موقعیت مکانی فعلی راننده در صورتی که ناوبری در پیشزمینه نباشد، استفاده کرد؟ - آیا SDK ناوبری از تعیین محدوده جغرافیایی (geofencing) پشتیبانی میکند؟
- آیا میتوانم اعلانها را وقتی برنامه ناوبری در پسزمینه است غیرفعال کنم؟
شخصیسازی رابط کاربری
- آیا میتوانم بهترین گزینه مسیر را با رنگ مشخص کنم؟
- آیا SDK ناوبری میتواند زمان تقریبی رسیدن به مقصد نهایی را نشان دهد؟
- چگونه میتوانم بهروزرسانیهای ETA را پنهان کنم؟
- چه سفارشیسازیهایی برای رابط کاربری کارتهای سربرگ و پاصفحه در دسترس است؟
مسیریابی
- آیا میتوانم یک مسیر خاص را به راننده ارائه دهم یا مسیرهای جایگزین را حذف کنم؟
- آیا میتوانم برچسبی متفاوت از مکان پیشفرض مقصد به راننده نشان دهم؟
- آیا میتوانم از کیت توسعه نرمافزار ناوبری (Navigation SDK) برای ردیابی انحرافات از یک مسیر تعریفشده استفاده کنم؟
- آیا راننده میتواند بدون تکمیل مسیر از ناوبری خارج شود؟
شبیهساز
گردشهای کاری
خدمات حمل و نقل
- استفاده از کیت توسعه نرمافزار ناوبری (Navigation SDK) چه تفاوتی برای مشتریان سرویسهای موبایل (Mobility Services) دارد؟
- چگونه میتوانم تشخیص دهم که آیا مشتری خدمات حمل و نقل هستم؟
- هزینهی خدمات ناوبری (Navigation SDK) برای مشتریان خدمات حمل و نقل (Mobility Services) چگونه محاسبه میشود؟
- کدام APIهای SDK ناوبری فقط باید توسط مشتریان سرویسهای تحرکپذیری استفاده شوند؟
- اگر من مشتری سرویسهای موبایلی باشم، آیا میتوانم از پیادهسازی SDK ناوبری که مربوط به سرویسهای موبایلی نیست نیز استفاده کنم؟
جزئیات محصول
- برنامه شما باید یک پنجره محاورهای با اطلاعیه شرایط خدمات Navigation SDK پیادهسازی کند که هر راننده باید آن را بپذیرد. این پنجره محاورهای به راننده فرصت میدهد تا با شرایط خدمات موافقت کند. یک فایل متنی از این شرایط به همراه Navigation SDK ارائه میشود.
- در اندروید، از متد
NavigationApi.showTermsAndConditionsDialogبرای نمایش کادر محاورهای حاوی شرایط استفاده کنید. - در iOS، تابع
GMSNavigationServices.showTermsAndConditionsDialogIfNeededWithCompanyNameرا فراخوانی کنید. - هر زبانی که توسط Google Maps Mobile پشتیبانی شود، به طور خودکار برای Navigation SDK در دسترس است. یک دستگاه دارای یک زبان سیستمی پیشفرض است و یک برنامه نمیتواند آن تنظیم را تغییر دهد؛ با این حال، برنامه به بیش از ۷۰ زبان دسترسی دارد.
بله. در اندروید، پس از شروع،
LocationListenerبه اجرا در پسزمینه ادامه میدهد. برنامه شما به ثبت موقعیت مکانی و حفظ جهت ادامه میدهد.در iOS، برای ادامه دریافت بهروزرسانیهای موقعیت مکانی و جهتیابی در پسزمینه، road snapping را پیادهسازی کنید و
allowsBackgroundLocationUpdatesرویYESتنظیم کنید.بله. وقتی یک مسیر ایجاد یا تغییر میکند،
RouteChangeListenerچندخطیها را ارائه میدهد.- خیر، کیت توسعه نرمافزار ناوبری (Navigation SDK) نیازی به نصب گوگل مپ موبایل روی دستگاه ندارد.
- خیر، در حال حاضر Navigation SDK این قابلیت را ارائه نمیدهد.
- بله. جهت ترافیک به صورت پیشفرض در دسترس و نمایش داده میشود.
مسائل
- در Xcode 12، برنامهها به درستی برای شبیهساز ساخته نمیشوند. چگونه میتوانم این مشکل را برطرف کنم؟
برای رفع این مشکل، تنظیمات ساخت پروژه Xcode خود را باز کنید و
arm64فقط برای ساختهای "iOS Simulator" بهExcluded Architecturesاضافه کنید.برای اطلاعات بیشتر، به تاپیک StackOverflow زیر مراجعه کنید.
- GMSMapView بارگذاری نمیشود.
اگر GMSMapView بارگذاری نشد:
- بررسی کنید که NavSDK در Cloud Console فعال باشد.
- اگر Nav SDK نصب شده است، اما پروژه شما از APIهای Nav SDK استفاده نمیکند، آن را از فایل باینری خود حذف کنید.
شبکه
- کیت توسعه نرمافزار ناوبری (Navigation SDK) چگونه اتصال ضعیف را مدیریت میکند؟
- کیت توسعه نرمافزار ناوبری (Navigation SDK) مسیر هر سفر را از قبل ذخیره میکند. اطلاعات از پیش ذخیره شده شامل اطلاعات مسیریابی به مدت ۱۵ تا ۲۰ دقیقه و مسیرهای جایگزین در صورتی که راننده از مسیر منحرف شود، میباشد. کیت توسعه نرمافزار ناوبری (Navigation SDK) با استفاده از GPS و حسگرهای دستگاه، موقعیت تقریبی را تعیین میکند.
- آیا حالت آفلاین در دسترس است؟
- خیر، کیت توسعه نرمافزار ناوبری (Navigation SDK) در حال حاضر حالت آفلاین ارائه نمیدهد؛ با این حال، این کیت، اطلاعات از پیش ذخیرهشده برای یک سفر را ارائه میدهد.
دادهها
- آیا میتوانم قبل از شروع مسیر، تمام توقفها/مقصدهای یک سفر را بازیابی کنم؟
بله. در اندروید، برای بازیابی مسیرهای یک مسیر، تابع
Navigator.getRouteSegments()را فراخوانی کنید.در iOS، تابع
GMSNavigator.routeLegs(read)را فراخوانی کنید.- آیا راهنمای مسیر گام به گام در ابتدای مسیر موجود است؟
- بله. کیت توسعه نرمافزار ناوبری (Navigation SDK) فهرستی از بخشهای مسیر را ارائه میدهد. علاوه بر این، راننده میتواند با کشیدن انگشت خود روی کارت مسیر در بالای صفحه، هر مانور را مشاهده کند.
- چگونه ETA به کاربران برنامه اطلاع داده میشود؟
در اندروید، از مراحل زیر برای ارائه اطلاعات ETA به کاربران برنامه استفاده کنید:
- با استفاده از
Navigator.getTimeAndDistanceList()زمان و مسافت را برای همه نقاط مسیر بازیابی کنید. - این اطلاعات را همانطور که برای زمان رسیدن به مقصد راننده انجام میدهید، به برنامه کلاینت نیز ارسال کنید.
در iOS، از این مراحل برای ارائه اطلاعات ETA به کاربران برنامه استفاده کنید:
- با استفاده از
Navigator.getRouteSegments()مسیرهای موجود در مسیر را بازیابی کنید. - برای هر مرحله از سفر، تابع
GMSNavigator.timeToNextDestinationرا فراخوانی کنید. - همانطور که برای زمان رسیدن به مقصد راننده (ETA) انجام میدهید، اطلاعات زمان را به برنامه کلاینت ارسال کنید.
- با استفاده از
- آیا میتوان از
RoadSnappedLocationProviderبرای به دست آوردن موقعیت مکانی فعلی راننده در صورتی که ناوبری در پیشزمینه نباشد، استفاده کرد؟ بله. در اندروید،
RoadSnappedLocationProviderبه طور پیشفرض در پسزمینه اجرا میشود.در iOS، برای اینکه ناوبری در پسزمینه اجرا شود، شنونده (listener) را برای
GMSRoadSnappedLocationProviderListenerپیادهسازی کنید و ویژگیallowsBackgroundLocationUpdatesرا رویTRUEتنظیم کنید.- آیا SDK ناوبری از تعیین محدوده جغرافیایی (geofencing) پشتیبانی میکند؟
خیر. در زمینه ناوبری،
remainingTimeOrdistanceChangeListenerنسبت به geofence مزیت دارد. geofence ممکن است هندسه جاده را در نظر نگیرد و ممکن است دقیقاً روی نقطهای که راننده در حال پیمایش است، متمرکز نباشد.شما میتوانید این قابلیت را با استفاده از
remainingTimeOrdistanceChangeListenerتقریب بزنید.- آستانه را برای تعیین فراوانی فراخوانیهای مجدد تنظیم کنید.
- مسافت باقی مانده تا مقصد را بررسی کنید.
برای مثال، اگر آستانه را روی ۱۰۰ متر تنظیم کنید، وقتی فاصله تا مقصد ۱۰۰ متر تغییر کند، یک تماس مجدد دریافت خواهید کرد. با کاهش فاصله، میتوانید این آستانه را به مقدار کمتری بهروزرسانی کنید و تماسهای مجدد بیشتری دریافت کنید. سپس، فاصله باقیمانده را بررسی کنید تا مشخص شود که آیا به اندازه کافی به محل تحویل/تحویل نزدیک هستید یا خیر.
در iOS، شنونده
GMSNavigatorListener.didUpdateRemainingDistanceرا برای مدیریت فاصله بین اعلانها پیادهسازی کنید.- آیا میتوانم اعلانها را وقتی برنامه ناوبری در پسزمینه است غیرفعال کنم؟
بله. در اندروید، از
Navigator.setHeadsUpNotificationEnabledبرای کنترل اعلانها استفاده کنید. این متد یک آرگومان بولی دارد.FALSEاعلانها را غیرفعال میکند؛TRUEاعلانها را فعال میکند.در iOS، با تنظیم
GMSRoadSnappedLocationProvider.allowsBackgroundLocationUpdatesروی NO، اعلانهای پسزمینه را برای مکانهای ثبتشده در جاده غیرفعال کنید.برای غیرفعال کردن پردازش پسزمینه برای سایر اعلانهای موقعیت مکانی، تابع
GMSNavigator.sendsBackgroundNotifications(NO)را فراخوانی کنید.
شخصیسازی رابط کاربری
- آیا میتوانم بهترین گزینه مسیر را با رنگ مشخص کنم؟
- خیر. در حال حاضر امکان رنگآمیزی یک مسیر خاص پشتیبانی نمیشود.
- آیا SDK ناوبری میتواند زمان تقریبی رسیدن به مقصد نهایی را نشان دهد؟
بله. در اندروید، از روشهای زیر استفاده کنید:
- با استفاده از
Navigator.getTimeAndDistanceList()زمان و مسافت را برای همه نقاط مسیر بازیابی کنید. - با استفاده از
NavigationFragment.setEtaCardEnabled(false)زمان رسیدن به نقطهی مسیر فعلی را مخفی کنید. - زمان تقریبی رسیدن به مقصد نهایی را رندر کنید.
در iOS از موارد زیر استفاده کنید:
- تابع
GMSNavigator.routeLegs(read)را فراخوانی میکند. - در آخرین مرحله،
GMSNavigator.timeToNextDestinationرا فراخوانی کنید. - با استفاده از
MSMapView.settings.navigationFooterEnabled=NOتا FALSE، زمان تقریبی رسیدن به نقطهی مسیر فعلی را مخفی کنید. - زمان تقریبی رسیدن به مقصد نهایی را رندر کنید.
- با استفاده از
- چگونه میتوانم بهروزرسانیهای ETA را پنهان کنم؟
شما میتوانید کارتهای ETA را با روشهای زیر غیرفعال کنید:
- در اندروید، از
navigationView.setEtaCardEnabled(false)استفاده کنید. - در iOS، از
GMSMapView.settings.navigationFooterEnabled=NOاستفاده کنید.
- در اندروید، از
در اندروید، از
StylingOptionsبرای تنظیم سبک رنگ پسزمینه استفاده میشود. برای پنهان کردن یا نمایش دادن سرصفحه و پاصفحه، از توابع عضوsetHeaderEnabledوsetFooterEnabledازNavigationFragmentاستفاده کنید.در iOS، از
GMSMapView.settings.navigationHeaderPrimaryBackgroundColorبرای تنظیم استایل رنگ پسزمینه استفاده کنید. برای پنهان کردن یا نمایش دادن سرصفحه و پاصفحه از ویژگیهایnavigationFooterEnabledوnavigationHeaderEnabledازGMSUISettingsاستفاده کنید.
مسیریابی
- آیا میتوانم یک مسیر خاص را به راننده ارائه دهم یا مسیرهای جایگزین را حذف کنم؟
- خیر. به طور پیشفرض، چندین مسیر ارائه میشود و سریعترین مسیر اولویت دارد. میتوانید با اضافه کردن تنظیمات برگزیده، مانند «اجتناب از بزرگراهها و عوارضیها»، به درخواست خود، مسیر پیشفرض را تغییر دهید. اضافه کردن نقاط مسیر نیز بر مسیر تأثیر میگذارد.
- آیا میتوانم به کاربر برنامه برچسبی متفاوت از مکان پیشفرض مقصد نشان دهم؟
بله. در اندروید، یک
Markerبا عنوان دلخواه برای مقصد و طول و عرض جغرافیایی ایجاد کنید. کیت توسعه نرمافزار ناوبری (Navigation SDK) عنوان دلخواه و مختصات را رویNavigationMapنمایش میدهد.در iOS، شما یک
GMSMarkerبرای مقصد ایجاد و نمایش میدهید.- آیا میتوانم از کیت توسعه نرمافزار ناوبری (Navigation SDK) برای ردیابی انحرافات از یک مسیر تعریفشده استفاده کنم؟
بله. در اندروید، از
Navigator.setRouteChangedListenerبرای دریافت اعلانها هنگام تغییر مسیر یا توصیه مسیر جدید استفاده کنید:- یک شنونده (listener) ثبت کنید که موقعیت دستگاه را در طول مسیر با استفاده از متد
Navigator.setRouteChangedListenerبررسی کند. - کد را به رویداد فراخوانی (callback event handler)،
onRouteChanged، اضافه کنید:- ارسال پیام به کاربر برنامه با اطلاعات بهروز شده ETA و فاصله.
- مکان دستگاه را ردیابی کنید.
- [اختیاری] سایر قابلیتهای مورد نیاز برنامه خود را برای مدیریت زمانی که راننده از مسیر تعیینشده خارج شده است، اضافه کنید.
در iOS، از
GMSNavigatorو شنوندههای آن برای دریافت اعلانها هنگام تغییر مسیر یا توصیه مسیر جدید استفاده کنید:- در کنترلر نمای نقشه، پروتکل
GMSNavigatorListenerو پروتکلGMSRoadSnappedLocationProviderListenerرا پیادهسازی کنید. - پیادهسازی
GMSNavigatorListener.navigatorDidChangeRoute - با استفاده از ویژگیهای
routeLegsوcurrentRouteLegازGMSNavigatorبه مسیر جدید دسترسی پیدا کنید.
- یک شنونده (listener) ثبت کنید که موقعیت دستگاه را در طول مسیر با استفاده از متد
بله. در اندروید، برای متوقف کردن ناوبری، متد
Navigator.stopGuidance()را فراخوانی کنید.در iOS،
GMSNavigator.clearDestinationsرا فراخوانی کنید.
شبیهساز
- آیا شبیهساز از تغییر مسیر پشتیبانی میکند؟
بله. در اندروید، برای شبیهسازی سفری که شامل تغییر مسیر است، تابع
simulateLocationsAlongNewRouteرا فراخوانی کنید. متدsimulateLocationsAlongExistingRouteتغییرات مسیر موجود را نادیده میگیرد.در iOS، از
GMSLocationSimulator.simulateAlongNewRouteToDestinationsبرای شبیهسازی سفری که شامل تغییر مسیر است استفاده کنید. اگر هیچ تغییری در مسیر پیشبینی نمیکنید، میتوانید ازGMSLocationSimulator.simulateLocationsAlongExistingRouteیاGMSLocationSimulator.simulateAlongNewRouteToDestinationsاستفاده کنید.
گردشهای کاری
- چگونه میتوانم پس از بستن یک اکتیویتی که حاوی یک قطعه ناوبری است، اعلان را رد کنم؟
اعلان ناوبری در طول ناوبری، زمانی که فعالیت بسته میشود، قابل مشاهده باقی میماند. وقتی وسیله نقلیه به مقصد میرسد، ناوبری متوقف میشود و اعلان ناپدید میشود.
برای مدیریت کلیکها روی اعلان، از
Navigator.startGuidance(intent resumeIntent)استفاده کنید.resume intentزمانی فعال میشود که کاربر برنامه روی اعلان کلیک کند. معمولاًNavigator.startguidance(getIntent())از Activity اصلی فراخوانی میشود که وقتی کاربر برنامه روی اعلان کلیک میکند، Activity را فراخوانی میکند.
خدمات حمل و نقل
سرویسهای تحرک پلتفرم نقشههای گوگل مجموعهای از APIها و SDKها را برای کمک به پشتیبانی از نیازهای سازمانی برای کسبوکارهای حملونقل و لجستیک ارائه میدهند. برای مشتریان سرویسهای تحرک، SDK ناوبری معمولاً همراه با سرویسهای مرتبط برای بهینهسازی مسیر، ارسال، ردیابی وظایف، تجزیه و تحلیل ناوگان و موارد دیگر استفاده میشود. SDK ناوبری همچنین برای مشتریان سرویسهای تحرک به صورت متفاوتی محاسبه میشود. برای اطلاعات بیشتر، به مستندات سرویسهای تحرک مراجعه کنید.
محصولات مربوط به حمل و نقل فقط برای مشتریان منتخب در دسترس هستند. برای اطلاعات بیشتر با نماینده فروش خود تماس بگیرید.
ReportBillableEvent در کد خود باشید. فقط مشتریان خدمات تحرک باید متد ReportBillableEvent فراخوانی کنند.چندین API در کیت توسعه نرمافزار ناوبری (Navigation SDK) وجود دارد که فقط برای استفاده مشتریان سرویسهای موبایلی (Mobility Services) در نظر گرفته شدهاند و گوگل برای آنها بر اساس هر تراکنش هزینه دریافت میکند. اگر شما مشتری سرویسهای موبایلی نیستید، روشهای زیر بیفایده هستند:
بله، مشتریان سرویسهای موبایلی میتوانند از هر دو پیادهسازی سرویسهای موبایلی و غیرموبایلیِ Navigation SDK استفاده کنند. با این حال، شما فقط میتوانید از یک نوع پیادهسازی در یک برنامه در یک زمان استفاده کنید. همچنین باید یک پروژه Google Cloud جدید، حساب پرداخت و کلید API ایجاد کنید، جدا از مواردی که با پیادهسازی سرویسهای موبایلی خود استفاده میکنید. برای اطلاعات بیشتر، به مرور کلی تنظیمات Navigation SDK مراجعه کنید.
برای اطلاعات بیشتر در مورد استفاده از پیادهسازی SDK ناوبری بدون سرویسهای حرکتی، از جمله انتقال برنامه از یک نوع پیادهسازی به نوع دیگر، با نماینده حساب گوگل خود تماس بگیرید.
توجه: اگر مشتری سرویسهای تحرک نیستید و علاقهمند به کسب اطلاعات بیشتر در مورد مجموعه APIها و SDKهای سرویسهای تحرک هستید، با بخش فروش پلتفرم نقشههای گوگل تماس بگیرید .
سوالات متداول
جزئیات محصول
- اطلاعیه شرایط خدمات SDK ناوبری چگونه باید نمایش داده شود؟
- راهنمای صوتی از چه زبانهایی پشتیبانی میکند؟
- آیا وقتی راننده از حالت ناوبری خارج میشود، جهتیابی حفظ میشود؟
- آیا خطوط چندخطی هنگام شروع یا تغییر مسیر در دسترس هستند؟
- آیا کاربران اپلیکیشن باید نقشه گوگل را روی موبایل نصب کرده باشند؟
- آیا SDK ناوبری میتواند پارکینگهای نزدیک رستورانها و سایر مقاصد را شناسایی کند؟
- آیا SDK ناوبری هنگام نزدیک شدن به یک نقطه پیچ، جهت ترافیک را در خطوط نشان میدهد؟
مسائل
- در Xcode 12، برنامهها به درستی برای شبیهساز ساخته نمیشوند. چگونه میتوانم این مشکل را برطرف کنم؟
-
GMSMapViewبارگذاری نمیشود.
شبکه
- کیت توسعه نرمافزار ناوبری (Navigation SDK) چگونه اتصال ضعیف را مدیریت میکند؟
- آیا حالت آفلاین در دسترس است؟
دادهها
- آیا میتوانم قبل از شروع مسیر، تمام توقفها/مقصدهای یک سفر را بازیابی کنم؟
- آیا راهنمای مسیر گام به گام در ابتدای مسیر موجود است؟
- زمان تخمینی رسیدن (ETA) چگونه به کاربران برنامه اطلاع داده میشود؟
- آیا میتوان از
RoadSnappedLocationProviderبرای به دست آوردن موقعیت مکانی فعلی راننده در صورتی که ناوبری در پیشزمینه نباشد، استفاده کرد؟ - آیا SDK ناوبری از تعیین محدوده جغرافیایی (geofencing) پشتیبانی میکند؟
- آیا میتوانم اعلانها را وقتی برنامه ناوبری در پسزمینه است غیرفعال کنم؟
شخصیسازی رابط کاربری
- آیا میتوانم بهترین گزینه مسیر را با رنگ مشخص کنم؟
- آیا SDK ناوبری میتواند زمان تقریبی رسیدن به مقصد نهایی را نشان دهد؟
- چگونه میتوانم بهروزرسانیهای ETA را پنهان کنم؟
- چه سفارشیسازیهایی برای رابط کاربری کارتهای سربرگ و پاصفحه در دسترس است؟
مسیریابی
- آیا میتوانم یک مسیر خاص را به راننده ارائه دهم یا مسیرهای جایگزین را حذف کنم؟
- Can I show the driver a different label for the destination than the default destination location?
- Can I use the Navigation SDK to track deviations from a defined path?
- Can the driver exit navigation without completing the route?
شبیهساز
گردشهای کاری
خدمات حمل و نقل
- How is using the Navigation SDK different for Mobility Services customers?
- How can I tell if I'm a Mobility Services customer?
- How is the Navigation SDK billed for Mobility Services customers?
- Which Navigation SDK APIs should only be used by Mobility Services customers?
- If I'm a Mobility Services customer, can I also use a non-Mobility Services implementation of the Navigation SDK?
جزئیات محصول
- Your app must implement a dialog with the Navigation SDK Terms of Service notice that each driver must accept. This dialog gives the driver the opportunity to agree with the Terms of Service. A text file of the terms is provided with the Navigation SDK.
- In Android, use the
NavigationApi.showTermsAndConditionsDialogmethod to display the dialog containing the terms. - In iOS, call
GMSNavigationServices.showTermsAndConditionsDialogIfNeededWithCompanyName. - Any languages supported by Google Maps Mobile are automatically available for the Navigation SDK. A device has a default system language and an app cannot change that setting; however, the app has access to over 70 languages.
Yes. In Android, once started, the
LocationListenercontinues to run in the background. Your app continues road snapping the position and maintains the bearing.In iOS, to continue receiving location updates of position and bearing in the background, implement road snapping and set
allowsBackgroundLocationUpdatestoYES.Yes. When a route is created or changed, the
RouteChangeListenerprovides polylines.- No, the Navigation SDK does not require Google Maps Mobile to be installed on the device.
- No, the Navigation SDK does not provide this functionality at this time.
- Yes. The traffic direction is available and displayed by default.
مسائل
- In Xcode 12, apps don't build correctly for the simulator. How can I fix this?
To fix this issue, open your Xcode project Build Settings, and add
arm64to theExcluded Architecturesfor "iOS Simulator" builds only.For more information, see the following StackOverflow thread .
- GMSMapView does not load.
If the GMSMapView does not load:
- Check that NavSDK is enabled in Cloud Console.
- If the Nav SDK is installed, but your project does not use Nav SDK APIs, remove it from your binary.
شبکه
- How does the Navigation SDK handle poor connectivity?
- The Navigation SDK pre-caches the route for each journey. The pre-cached information includes routing information for 15-20 minutes, and route alternatives in case the driver deviates from the route. The Navigation SDK approximates position using the device GPS and sensors.
- Is an offline mode available?
- No, the Navigation SDK does not offer an offline mode at this time; however, the SDK does provide pre-cached information for a journey.
دادهها
- Can I retrieve all of the stops/destinations in a journey before starting the route?
Yes. In Android, to retrieve the directions for a route, call
Navigator.getRouteSegments().In iOS, call
GMSNavigator.routeLegs(read).- Is turn-by-turn route guidance available at the start of a route?
- Yes. The Navigation SDK provides a list of route segments. In addition, the driver can swipe through the directions card in the header to see each maneuver.
- How is ETA communicated to the app users?
In Android, use the following steps to give ETA information to app users:
- Retrieve the time and distance for all waypoints using
Navigator.getTimeAndDistanceList(). - Forward this information to the client application as you do for the driver ETA.
In iOS, use these steps to give ETA information to app users:
- Retrieve the legs in the journey using
Navigator.getRouteSegments(). - Call
GMSNavigator.timeToNextDestinationfor each journey leg. - Forward the time information to the client application as you do for the driver ETA.
- Retrieve the time and distance for all waypoints using
- Can the
RoadSnappedLocationProviderbe used to obtain the driver's current snapped location if navigation is not in the foreground? Yes. In Android, the
RoadSnappedLocationProviderruns in the background by default.In iOS, to keep navigation running in the background, implement the listener for
GMSRoadSnappedLocationProviderListener, and set the propertyallowsBackgroundLocationUpdatestoTRUE.- Does the Navigation SDK support geofencing?
No. In the context of navigation,
remainingTimeOrdistanceChangeListenerhas an advantage over a geofence. The geofence might not account for road geometry, and might not be centered on the exact point to which the driver is navigating.You can approximate this functionality using
remainingTimeOrdistanceChangeListener.- Set the threshold to determine the frequency of the callbacks.
- Check the remaining distance to the destination.
For example, if you set the threshold to 100m, you receive a callback when the distance to the destination changes by 100m. As the distance decreases, you can update this threshold to a smaller value and receive more frequent callbacks. Then, inspect the remaining distance to determine if you are close enough to the pickup/drop-off location.
In iOS, implement the listener
GMSNavigatorListener.didUpdateRemainingDistanceto manage the distance between notifications.- Can I disable notifications when the Navigation app is in the background?
Yes. In Android, use
Navigator.setHeadsUpNotificationEnabledto control notifications. This method has a boolean argument.FALSEdisables notifications;TRUEenables notifications.In iOS, disable background notification for road-snapped locations by setting
GMSRoadSnappedLocationProvider.allowsBackgroundLocationUpdatesto NO.To disable background processing for other location notifications, call
GMSNavigator.sendsBackgroundNotifications(NO).
شخصیسازی رابط کاربری
- Can I color code the best route option?
- No. Color coding a specific route option is not supported at this time.
- Can the Navigation SDK show the ETA for the final destination?
Yes. In Android, use the following methods:
- Retrieve the time and distance for all waypoints using
Navigator.getTimeAndDistanceList(). - Hide the ETA of the current waypoint using
NavigationFragment.setEtaCardEnabled(false). - Render the final destination ETA.
In iOS, use the following:
- Call
GMSNavigator.routeLegs(read). - With the last leg, call
GMSNavigator.timeToNextDestination. - Hide the ETA of the current waypoint using
MSMapView.settings.navigationFooterEnabled=NOto FALSE. - Render the final destination ETA.
- Retrieve the time and distance for all waypoints using
- How can I hide ETA updates?
You can disable ETA cards with the following methods:
- In Android, use
navigationView.setEtaCardEnabled(false). - In iOS, use
GMSMapView.settings.navigationFooterEnabled=NO.
- In Android, use
In Android, you use
StylingOptionsto set the background color styling. To hide or show the header and footer, use thesetHeaderEnabledandsetFooterEnabledmember functions ofNavigationFragment.In iOS, use
GMSMapView.settings.navigationHeaderPrimaryBackgroundColorto set the background color styling. To hide or show the header and footer usenavigationFooterEnabledandnavigationHeaderEnabledproperties ofGMSUISettings.
مسیریابی
- Can I provide a specific route to a driver or remove alternative routes?
- No. By default, multiple routes are provided and the fastest route has priority. You can affect the default route by adding preferences, such as "avoid highways and tolls," to your request. Adding waypoints also affects the route.
- Can I show the app user a different label for the destination than the default destination location?
Yes. In Android, create a
Markerwith a custom title for the destination and the latitude/longitude. The Navigation SDK displays the custom title and the coordinates on theNavigationMap.In iOS, you create and display a
GMSMarkerfor the destination.- Can I use the Navigation SDK to track deviations from a defined path?
Yes. In Android, use
Navigator.setRouteChangedListenerto receive notifications when a route changes or a new route is recommended:- Register a listener that checks the device position along the route using the
Navigator.setRouteChangedListenermethod. - Add code to the callback event handler,
onRouteChanged:- Send a message to the app user with updated ETA and distance information.
- Track the device's location.
- [optional] Add other functionality required by your app to handle when the driver is off the prescribed route.
In iOS, use the
GMSNavigatorand its listeners to receive notifications when a route changes or a new route is recommended:- On the map's view controller, implement the
GMSNavigatorListenerprotocol and theGMSRoadSnappedLocationProviderListenerprotocol. - Implement
GMSNavigatorListener.navigatorDidChangeRoute. - Access the new route using
routeLegsandcurrentRouteLegproperties of theGMSNavigator.
- Register a listener that checks the device position along the route using the
Yes. In Android, call the
Navigator.stopGuidance()method to stop navigation.In iOS, call
GMSNavigator.clearDestinations.
شبیهساز
- Does the simulator support route changes?
Yes. In Android, call
simulateLocationsAlongNewRouteto simulate a journey that includes a route change. ThesimulateLocationsAlongExistingRoutemethod ignores changes to the existing route.In iOS, use
GMSLocationSimulator.simulateAlongNewRouteToDestinationsto simulate a journey that includes a route change. If you don't anticipate any route changes, you can useGMSLocationSimulator.simulateLocationsAlongExistingRouteorGMSLocationSimulator.simulateAlongNewRouteToDestinations.
گردشهای کاری
- How do I dismiss the notification after closing an activity that contains a navigation fragment?
The navigation notification remains visible during navigation, when the activity is closed. When the vehicle arrives at the destination, navigation stops, and the notification disappears.
To handle clicks on the notification, use the
Navigator.startGuidance(intent resumeIntent). Theresume intentfires when the app user clicks the notification. Typically, theNavigator.startguidance(getIntent())is called from the main Activity, which recalls the Activity when the app user clicks the notification.
خدمات حمل و نقل
Google Maps Platform Mobility Services offer a collection of APIs and SDKs to help support enterprise needs for transportation and logistics businesses. For Mobility Services customers, the Navigation SDK is typically used in conjunction with related services for route optimization, dispatch, task tracking, fleet analytics, and more. The Navigation SDK is also billed differently for Mobility Services customers. For more information, see the Mobility Services documentation.
Mobility products are available only to select customers. Contact your sales representative for more information.
ReportBillableEvent call in your code. Only Mobility Services customers should call the ReportBillableEvent method.There are several APIs in the Navigation SDK that are only intended for use by Mobility Services customers, who are billed by Google on a per-transaction basis. If you are not a Mobility Services customer, the following methods are no-ops:
Yes, Mobility Services customers can use both Mobility Services and non-Mobility Services implementations of the Navigation SDK. However, you can only use one implementation type in an app at one time. You also need to create a new Google Cloud project, billing account, and API key, separate from those that you use with your Mobility Services implementation. For more information, see the Navigation SDK setup overview .
For more information about using a non-Mobility Services implementation of the Navigation SDK, including migrating an app from one implementation type to the other, contact your Google account representative.
Note: If you are not a Mobility Services customer and are interested in learning more about the Mobility Services collection of APIs and SDKs, contact Google Maps Platform sales .
سوالات متداول
جزئیات محصول
- How should the Navigation SDK Terms of Service notice be shown?
- Which languages does voice guidance support?
- Is the bearing maintained when the driver exits navigation mode?
- Are polylines available when starting or changing a route?
- Do app users need to have Google Maps mobile installed?
- Can the Navigation SDK identify parking near restaurants and other destinations?
- Does the Navigation SDK show traffic direction in the lanes when approaching a turning point?
مسائل
- In Xcode 12, apps don't build correctly for the simulator. How can I fix this?
-
GMSMapViewdoes not load.
شبکه
دادهها
- Can I retrieve all of the stops/destinations in a journey before starting the route?
- Is turn-by-turn route guidance available at the start of a route?
- How is the Estimated Time of Arrival (ETA) communicated to the app users?
- Can the
RoadSnappedLocationProviderbe used to obtain the driver's current snapped location if navigation is not in the foreground? - Does the Navigation SDK support geofencing?
- Can I disable notifications when the Navigation app is in the background?
شخصیسازی رابط کاربری
- Can I color code the best route option?
- Can the Navigation SDK show the ETA for the final destination?
- How can I hide the ETA updates?
- Which UI customizations are available for the header and footer cards?
مسیریابی
- Can I provide a specific route to a driver or remove alternative routes?
- Can I show the driver a different label for the destination than the default destination location?
- Can I use the Navigation SDK to track deviations from a defined path?
- Can the driver exit navigation without completing the route?
شبیهساز
گردشهای کاری
خدمات حمل و نقل
- How is using the Navigation SDK different for Mobility Services customers?
- How can I tell if I'm a Mobility Services customer?
- How is the Navigation SDK billed for Mobility Services customers?
- Which Navigation SDK APIs should only be used by Mobility Services customers?
- If I'm a Mobility Services customer, can I also use a non-Mobility Services implementation of the Navigation SDK?
جزئیات محصول
- Your app must implement a dialog with the Navigation SDK Terms of Service notice that each driver must accept. This dialog gives the driver the opportunity to agree with the Terms of Service. A text file of the terms is provided with the Navigation SDK.
- In Android, use the
NavigationApi.showTermsAndConditionsDialogmethod to display the dialog containing the terms. - In iOS, call
GMSNavigationServices.showTermsAndConditionsDialogIfNeededWithCompanyName. - Any languages supported by Google Maps Mobile are automatically available for the Navigation SDK. A device has a default system language and an app cannot change that setting; however, the app has access to over 70 languages.
Yes. In Android, once started, the
LocationListenercontinues to run in the background. Your app continues road snapping the position and maintains the bearing.In iOS, to continue receiving location updates of position and bearing in the background, implement road snapping and set
allowsBackgroundLocationUpdatestoYES.Yes. When a route is created or changed, the
RouteChangeListenerprovides polylines.- No, the Navigation SDK does not require Google Maps Mobile to be installed on the device.
- No, the Navigation SDK does not provide this functionality at this time.
- Yes. The traffic direction is available and displayed by default.
مسائل
- In Xcode 12, apps don't build correctly for the simulator. How can I fix this?
To fix this issue, open your Xcode project Build Settings, and add
arm64to theExcluded Architecturesfor "iOS Simulator" builds only.For more information, see the following StackOverflow thread .
- GMSMapView does not load.
If the GMSMapView does not load:
- Check that NavSDK is enabled in Cloud Console.
- If the Nav SDK is installed, but your project does not use Nav SDK APIs, remove it from your binary.
شبکه
- How does the Navigation SDK handle poor connectivity?
- The Navigation SDK pre-caches the route for each journey. The pre-cached information includes routing information for 15-20 minutes, and route alternatives in case the driver deviates from the route. The Navigation SDK approximates position using the device GPS and sensors.
- Is an offline mode available?
- No, the Navigation SDK does not offer an offline mode at this time; however, the SDK does provide pre-cached information for a journey.
دادهها
- Can I retrieve all of the stops/destinations in a journey before starting the route?
Yes. In Android, to retrieve the directions for a route, call
Navigator.getRouteSegments().In iOS, call
GMSNavigator.routeLegs(read).- Is turn-by-turn route guidance available at the start of a route?
- Yes. The Navigation SDK provides a list of route segments. In addition, the driver can swipe through the directions card in the header to see each maneuver.
- How is ETA communicated to the app users?
In Android, use the following steps to give ETA information to app users:
- Retrieve the time and distance for all waypoints using
Navigator.getTimeAndDistanceList(). - Forward this information to the client application as you do for the driver ETA.
In iOS, use these steps to give ETA information to app users:
- Retrieve the legs in the journey using
Navigator.getRouteSegments(). - Call
GMSNavigator.timeToNextDestinationfor each journey leg. - Forward the time information to the client application as you do for the driver ETA.
- Retrieve the time and distance for all waypoints using
- Can the
RoadSnappedLocationProviderbe used to obtain the driver's current snapped location if navigation is not in the foreground? Yes. In Android, the
RoadSnappedLocationProviderruns in the background by default.In iOS, to keep navigation running in the background, implement the listener for
GMSRoadSnappedLocationProviderListener, and set the propertyallowsBackgroundLocationUpdatestoTRUE.- Does the Navigation SDK support geofencing?
No. In the context of navigation,
remainingTimeOrdistanceChangeListenerhas an advantage over a geofence. The geofence might not account for road geometry, and might not be centered on the exact point to which the driver is navigating.You can approximate this functionality using
remainingTimeOrdistanceChangeListener.- Set the threshold to determine the frequency of the callbacks.
- Check the remaining distance to the destination.
For example, if you set the threshold to 100m, you receive a callback when the distance to the destination changes by 100m. As the distance decreases, you can update this threshold to a smaller value and receive more frequent callbacks. Then, inspect the remaining distance to determine if you are close enough to the pickup/drop-off location.
In iOS, implement the listener
GMSNavigatorListener.didUpdateRemainingDistanceto manage the distance between notifications.- Can I disable notifications when the Navigation app is in the background?
Yes. In Android, use
Navigator.setHeadsUpNotificationEnabledto control notifications. This method has a boolean argument.FALSEdisables notifications;TRUEenables notifications.In iOS, disable background notification for road-snapped locations by setting
GMSRoadSnappedLocationProvider.allowsBackgroundLocationUpdatesto NO.To disable background processing for other location notifications, call
GMSNavigator.sendsBackgroundNotifications(NO).
شخصیسازی رابط کاربری
- Can I color code the best route option?
- No. Color coding a specific route option is not supported at this time.
- Can the Navigation SDK show the ETA for the final destination?
Yes. In Android, use the following methods:
- Retrieve the time and distance for all waypoints using
Navigator.getTimeAndDistanceList(). - Hide the ETA of the current waypoint using
NavigationFragment.setEtaCardEnabled(false). - Render the final destination ETA.
In iOS, use the following:
- Call
GMSNavigator.routeLegs(read). - With the last leg, call
GMSNavigator.timeToNextDestination. - Hide the ETA of the current waypoint using
MSMapView.settings.navigationFooterEnabled=NOto FALSE. - Render the final destination ETA.
- Retrieve the time and distance for all waypoints using
- How can I hide ETA updates?
You can disable ETA cards with the following methods:
- In Android, use
navigationView.setEtaCardEnabled(false). - In iOS, use
GMSMapView.settings.navigationFooterEnabled=NO.
- In Android, use
In Android, you use
StylingOptionsto set the background color styling. To hide or show the header and footer, use thesetHeaderEnabledandsetFooterEnabledmember functions ofNavigationFragment.In iOS, use
GMSMapView.settings.navigationHeaderPrimaryBackgroundColorto set the background color styling. To hide or show the header and footer usenavigationFooterEnabledandnavigationHeaderEnabledproperties ofGMSUISettings.
مسیریابی
- Can I provide a specific route to a driver or remove alternative routes?
- No. By default, multiple routes are provided and the fastest route has priority. You can affect the default route by adding preferences, such as "avoid highways and tolls," to your request. Adding waypoints also affects the route.
- Can I show the app user a different label for the destination than the default destination location?
Yes. In Android, create a
Markerwith a custom title for the destination and the latitude/longitude. The Navigation SDK displays the custom title and the coordinates on theNavigationMap.In iOS, you create and display a
GMSMarkerfor the destination.- Can I use the Navigation SDK to track deviations from a defined path?
Yes. In Android, use
Navigator.setRouteChangedListenerto receive notifications when a route changes or a new route is recommended:- Register a listener that checks the device position along the route using the
Navigator.setRouteChangedListenermethod. - Add code to the callback event handler,
onRouteChanged:- Send a message to the app user with updated ETA and distance information.
- Track the device's location.
- [optional] Add other functionality required by your app to handle when the driver is off the prescribed route.
In iOS, use the
GMSNavigatorand its listeners to receive notifications when a route changes or a new route is recommended:- On the map's view controller, implement the
GMSNavigatorListenerprotocol and theGMSRoadSnappedLocationProviderListenerprotocol. - Implement
GMSNavigatorListener.navigatorDidChangeRoute. - Access the new route using
routeLegsandcurrentRouteLegproperties of theGMSNavigator.
- Register a listener that checks the device position along the route using the
Yes. In Android, call the
Navigator.stopGuidance()method to stop navigation.In iOS, call
GMSNavigator.clearDestinations.
شبیهساز
- Does the simulator support route changes?
Yes. In Android, call
simulateLocationsAlongNewRouteto simulate a journey that includes a route change. ThesimulateLocationsAlongExistingRoutemethod ignores changes to the existing route.In iOS, use
GMSLocationSimulator.simulateAlongNewRouteToDestinationsto simulate a journey that includes a route change. If you don't anticipate any route changes, you can useGMSLocationSimulator.simulateLocationsAlongExistingRouteorGMSLocationSimulator.simulateAlongNewRouteToDestinations.
گردشهای کاری
- How do I dismiss the notification after closing an activity that contains a navigation fragment?
The navigation notification remains visible during navigation, when the activity is closed. When the vehicle arrives at the destination, navigation stops, and the notification disappears.
To handle clicks on the notification, use the
Navigator.startGuidance(intent resumeIntent). Theresume intentfires when the app user clicks the notification. Typically, theNavigator.startguidance(getIntent())is called from the main Activity, which recalls the Activity when the app user clicks the notification.
خدمات حمل و نقل
Google Maps Platform Mobility Services offer a collection of APIs and SDKs to help support enterprise needs for transportation and logistics businesses. For Mobility Services customers, the Navigation SDK is typically used in conjunction with related services for route optimization, dispatch, task tracking, fleet analytics, and more. The Navigation SDK is also billed differently for Mobility Services customers. For more information, see the Mobility Services documentation.
Mobility products are available only to select customers. Contact your sales representative for more information.
ReportBillableEvent call in your code. Only Mobility Services customers should call the ReportBillableEvent method.There are several APIs in the Navigation SDK that are only intended for use by Mobility Services customers, who are billed by Google on a per-transaction basis. If you are not a Mobility Services customer, the following methods are no-ops:
Yes, Mobility Services customers can use both Mobility Services and non-Mobility Services implementations of the Navigation SDK. However, you can only use one implementation type in an app at one time. You also need to create a new Google Cloud project, billing account, and API key, separate from those that you use with your Mobility Services implementation. For more information, see the Navigation SDK setup overview .
For more information about using a non-Mobility Services implementation of the Navigation SDK, including migrating an app from one implementation type to the other, contact your Google account representative.
Note: If you are not a Mobility Services customer and are interested in learning more about the Mobility Services collection of APIs and SDKs, contact Google Maps Platform sales .