سوالات متداول

جزئیات محصول

مسائل

شبکه

داده‌ها

شخصی‌سازی رابط کاربری

مسیریابی

شبیه‌ساز

گردش‌های کاری

خدمات حمل و نقل

جزئیات محصول

برنامه شما باید یک پنجره محاوره‌ای با اطلاعیه شرایط خدمات 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 به کاربران برنامه استفاده کنید:

  1. با استفاده از Navigator.getTimeAndDistanceList() زمان و مسافت را برای همه نقاط مسیر بازیابی کنید.
  2. این اطلاعات را همانطور که برای زمان رسیدن به مقصد راننده انجام می‌دهید، به برنامه کلاینت نیز ارسال کنید.

در iOS، از این مراحل برای ارائه اطلاعات ETA به کاربران برنامه استفاده کنید:

  1. با استفاده از Navigator.getRouteSegments() مسیرهای موجود در مسیر را بازیابی کنید.
  2. برای هر مرحله از سفر، تابع GMSNavigator.timeToNextDestination را فراخوانی کنید.
  3. همانطور که برای زمان رسیدن به مقصد راننده (ETA) انجام می‌دهید، اطلاعات زمان را به برنامه کلاینت ارسال کنید.
آیا می‌توان از RoadSnappedLocationProvider برای به دست آوردن موقعیت مکانی فعلی راننده در صورتی که ناوبری در پیش‌زمینه نباشد، استفاده کرد؟

بله. در اندروید، RoadSnappedLocationProvider به طور پیش‌فرض در پس‌زمینه اجرا می‌شود.

در iOS، برای اینکه ناوبری در پس‌زمینه اجرا شود، شنونده (listener) را برای GMSRoadSnappedLocationProviderListener پیاده‌سازی کنید و ویژگی allowsBackgroundLocationUpdates را روی TRUE تنظیم کنید.

آیا SDK ناوبری از تعیین محدوده جغرافیایی (geofencing) پشتیبانی می‌کند؟

خیر. در زمینه ناوبری، remainingTimeOrdistanceChangeListener نسبت به geofence مزیت دارد. geofence ممکن است هندسه جاده را در نظر نگیرد و ممکن است دقیقاً روی نقطه‌ای که راننده در حال پیمایش است، متمرکز نباشد.

شما می‌توانید این قابلیت را با استفاده از remainingTimeOrdistanceChangeListener تقریب بزنید.

  1. آستانه را برای تعیین فراوانی فراخوانی‌های مجدد تنظیم کنید.
  2. مسافت باقی مانده تا مقصد را بررسی کنید.

برای مثال، اگر آستانه را روی ۱۰۰ متر تنظیم کنید، وقتی فاصله تا مقصد ۱۰۰ متر تغییر کند، یک تماس مجدد دریافت خواهید کرد. با کاهش فاصله، می‌توانید این آستانه را به مقدار کمتری به‌روزرسانی کنید و تماس‌های مجدد بیشتری دریافت کنید. سپس، فاصله باقی‌مانده را بررسی کنید تا مشخص شود که آیا به اندازه کافی به محل تحویل/تحویل نزدیک هستید یا خیر.

در iOS، شنونده GMSNavigatorListener.didUpdateRemainingDistance را برای مدیریت فاصله بین اعلان‌ها پیاده‌سازی کنید.

آیا می‌توانم اعلان‌ها را وقتی برنامه ناوبری در پس‌زمینه است غیرفعال کنم؟

بله. در اندروید، از Navigator.setHeadsUpNotificationEnabled برای کنترل اعلان‌ها استفاده کنید. این متد یک آرگومان بولی دارد. FALSE اعلان‌ها را غیرفعال می‌کند؛ TRUE اعلان‌ها را فعال می‌کند.

در iOS، با تنظیم GMSRoadSnappedLocationProvider.allowsBackgroundLocationUpdates روی NO، اعلان‌های پس‌زمینه را برای مکان‌های ثبت‌شده در جاده غیرفعال کنید.

برای غیرفعال کردن پردازش پس‌زمینه برای سایر اعلان‌های موقعیت مکانی، تابع GMSNavigator.sendsBackgroundNotifications(NO) را فراخوانی کنید.

شخصی‌سازی رابط کاربری

آیا می‌توانم بهترین گزینه مسیر را با رنگ مشخص کنم؟
خیر. در حال حاضر امکان رنگ‌آمیزی یک مسیر خاص پشتیبانی نمی‌شود.
آیا SDK ناوبری می‌تواند زمان تقریبی رسیدن به مقصد نهایی را نشان دهد؟

بله. در اندروید، از روش‌های زیر استفاده کنید:

  1. با استفاده از Navigator.getTimeAndDistanceList() زمان و مسافت را برای همه نقاط مسیر بازیابی کنید.
  2. با استفاده از NavigationFragment.setEtaCardEnabled(false) زمان رسیدن به نقطه‌ی مسیر فعلی را مخفی کنید.
  3. زمان تقریبی رسیدن به مقصد نهایی را رندر کنید.

در iOS از موارد زیر استفاده کنید:

  1. تابع GMSNavigator.routeLegs(read) را فراخوانی می‌کند.
  2. در آخرین مرحله، GMSNavigator.timeToNextDestination را فراخوانی کنید.
  3. با استفاده از MSMapView.settings.navigationFooterEnabled=NO تا FALSE، زمان تقریبی رسیدن به نقطه‌ی مسیر فعلی را مخفی کنید.
  4. زمان تقریبی رسیدن به مقصد نهایی را رندر کنید.
چگونه می‌توانم به‌روزرسانی‌های 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 برای دریافت اعلان‌ها هنگام تغییر مسیر یا توصیه مسیر جدید استفاده کنید:

  1. یک شنونده (listener) ثبت کنید که موقعیت دستگاه را در طول مسیر با استفاده از متد Navigator.setRouteChangedListener بررسی کند.
  2. کد را به رویداد فراخوانی (callback event handler)، onRouteChanged ، اضافه کنید:
    • ارسال پیام به کاربر برنامه با اطلاعات به‌روز شده ETA و فاصله.
    • مکان دستگاه را ردیابی کنید.
    • [اختیاری] سایر قابلیت‌های مورد نیاز برنامه خود را برای مدیریت زمانی که راننده از مسیر تعیین‌شده خارج شده است، اضافه کنید.

در iOS، از GMSNavigator و شنونده‌های آن برای دریافت اعلان‌ها هنگام تغییر مسیر یا توصیه مسیر جدید استفاده کنید:

  1. در کنترلر نمای نقشه، پروتکل GMSNavigatorListener و پروتکل GMSRoadSnappedLocationProviderListener را پیاده‌سازی کنید.
  2. پیاده‌سازی GMSNavigatorListener.navigatorDidChangeRoute
  3. با استفاده از ویژگی‌های routeLegs و currentRouteLeg از GMSNavigator به مسیر جدید دسترسی پیدا کنید.
آیا راننده می‌تواند بدون تکمیل مسیر از ناوبری خارج شود؟

بله. در اندروید، برای متوقف کردن ناوبری، متد 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 را فراخوانی می‌کند.

خدمات حمل و نقل

استفاده از کیت توسعه نرم‌افزار ناوبری (Navigation SDK) چه تفاوتی برای مشتریان سرویس‌های موبایل (Mobility Services) دارد؟

سرویس‌های تحرک پلتفرم نقشه‌های گوگل مجموعه‌ای از APIها و SDKها را برای کمک به پشتیبانی از نیازهای سازمانی برای کسب‌وکارهای حمل‌ونقل و لجستیک ارائه می‌دهند. برای مشتریان سرویس‌های تحرک، SDK ناوبری معمولاً همراه با سرویس‌های مرتبط برای بهینه‌سازی مسیر، ارسال، ردیابی وظایف، تجزیه و تحلیل ناوگان و موارد دیگر استفاده می‌شود. SDK ناوبری همچنین برای مشتریان سرویس‌های تحرک به صورت متفاوتی محاسبه می‌شود. برای اطلاعات بیشتر، به مستندات سرویس‌های تحرک مراجعه کنید.

محصولات مربوط به حمل و نقل فقط برای مشتریان منتخب در دسترس هستند. برای اطلاعات بیشتر با نماینده فروش خود تماس بگیرید.

چگونه می‌توانم تشخیص دهم که آیا مشتری خدمات حمل و نقل هستم؟
اگر مطمئن نیستید که آیا SDK ناوبری را به عنوان یک مشتری خدمات تحرک پیاده‌سازی می‌کنید یا خیر، به دنبال فراخوانی ReportBillableEvent در کد خود باشید. فقط مشتریان خدمات تحرک باید متد ReportBillableEvent فراخوانی کنند.

هزینه‌ی خدمات ناوبری (Navigation SDK) برای مشتریان خدمات حمل و نقل (Mobility Services) چگونه محاسبه می‌شود؟
برای مشتریان خدمات تحرک، صورتحساب و قیمت‌گذاری برای SDK ناوبری به توافق‌نامه خدماتی که با پلتفرم نقشه‌های گوگل دارید بستگی دارد. برای کسب اطلاعات در مورد تأیید صحت صورتحساب پیاده‌سازی خدمات تحرک، به اعتبارسنجی صورتحساب مراجعه کنید. برای اطلاعات بیشتر در مورد صورتحساب خدمات تحرک، با نماینده فروش خود تماس بگیرید.

کدام APIهای SDK ناوبری فقط باید توسط مشتریان سرویس‌های تحرک‌پذیری استفاده شوند؟

چندین API در کیت توسعه نرم‌افزار ناوبری (Navigation SDK) وجود دارد که فقط برای استفاده مشتریان سرویس‌های موبایلی (Mobility Services) در نظر گرفته شده‌اند و گوگل برای آنها بر اساس هر تراکنش هزینه دریافت می‌کند. اگر شما مشتری سرویس‌های موبایلی نیستید، روش‌های زیر بی‌فایده هستند:

اگر من مشتری سرویس‌های موبایلی باشم، آیا می‌توانم از پیاده‌سازی SDK ناوبری که مربوط به سرویس‌های موبایلی نیست نیز استفاده کنم؟

بله، مشتریان سرویس‌های موبایلی می‌توانند از هر دو پیاده‌سازی سرویس‌های موبایلی و غیرموبایلیِ Navigation SDK استفاده کنند. با این حال، شما فقط می‌توانید از یک نوع پیاده‌سازی در یک برنامه در یک زمان استفاده کنید. همچنین باید یک پروژه Google Cloud جدید، حساب پرداخت و کلید API ایجاد کنید، جدا از مواردی که با پیاده‌سازی سرویس‌های موبایلی خود استفاده می‌کنید. برای اطلاعات بیشتر، به مرور کلی تنظیمات Navigation SDK مراجعه کنید.

برای اطلاعات بیشتر در مورد استفاده از پیاده‌سازی SDK ناوبری بدون سرویس‌های حرکتی، از جمله انتقال برنامه از یک نوع پیاده‌سازی به نوع دیگر، با نماینده حساب گوگل خود تماس بگیرید.

توجه: اگر مشتری سرویس‌های تحرک نیستید و علاقه‌مند به کسب اطلاعات بیشتر در مورد مجموعه APIها و 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 به کاربران برنامه استفاده کنید:

  1. با استفاده از Navigator.getTimeAndDistanceList() زمان و مسافت را برای همه نقاط مسیر بازیابی کنید.
  2. این اطلاعات را همانطور که برای زمان رسیدن به مقصد راننده انجام می‌دهید، به برنامه کلاینت نیز ارسال کنید.

در iOS، از این مراحل برای ارائه اطلاعات ETA به کاربران برنامه استفاده کنید:

  1. با استفاده از Navigator.getRouteSegments() مسیرهای موجود در مسیر را بازیابی کنید.
  2. برای هر مرحله از سفر، تابع GMSNavigator.timeToNextDestination را فراخوانی کنید.
  3. همانطور که برای زمان رسیدن به مقصد راننده (ETA) انجام می‌دهید، اطلاعات زمان را به برنامه کلاینت ارسال کنید.
آیا می‌توان از RoadSnappedLocationProvider برای به دست آوردن موقعیت مکانی فعلی راننده در صورتی که ناوبری در پیش‌زمینه نباشد، استفاده کرد؟

بله. در اندروید، RoadSnappedLocationProvider به طور پیش‌فرض در پس‌زمینه اجرا می‌شود.

در iOS، برای اینکه ناوبری در پس‌زمینه اجرا شود، شنونده (listener) را برای GMSRoadSnappedLocationProviderListener پیاده‌سازی کنید و ویژگی allowsBackgroundLocationUpdates را روی TRUE تنظیم کنید.

آیا SDK ناوبری از تعیین محدوده جغرافیایی (geofencing) پشتیبانی می‌کند؟

خیر. در زمینه ناوبری، remainingTimeOrdistanceChangeListener نسبت به geofence مزیت دارد. geofence ممکن است هندسه جاده را در نظر نگیرد و ممکن است دقیقاً روی نقطه‌ای که راننده در حال پیمایش است، متمرکز نباشد.

شما می‌توانید این قابلیت را با استفاده از remainingTimeOrdistanceChangeListener تقریب بزنید.

  1. آستانه را برای تعیین فراوانی فراخوانی‌های مجدد تنظیم کنید.
  2. مسافت باقی مانده تا مقصد را بررسی کنید.

برای مثال، اگر آستانه را روی ۱۰۰ متر تنظیم کنید، وقتی فاصله تا مقصد ۱۰۰ متر تغییر کند، یک تماس مجدد دریافت خواهید کرد. با کاهش فاصله، می‌توانید این آستانه را به مقدار کمتری به‌روزرسانی کنید و تماس‌های مجدد بیشتری دریافت کنید. سپس، فاصله باقی‌مانده را بررسی کنید تا مشخص شود که آیا به اندازه کافی به محل تحویل/تحویل نزدیک هستید یا خیر.

در iOS، شنونده GMSNavigatorListener.didUpdateRemainingDistance را برای مدیریت فاصله بین اعلان‌ها پیاده‌سازی کنید.

آیا می‌توانم اعلان‌ها را وقتی برنامه ناوبری در پس‌زمینه است غیرفعال کنم؟

بله. در اندروید، از Navigator.setHeadsUpNotificationEnabled برای کنترل اعلان‌ها استفاده کنید. این متد یک آرگومان بولی دارد. FALSE اعلان‌ها را غیرفعال می‌کند؛ TRUE اعلان‌ها را فعال می‌کند.

در iOS، با تنظیم GMSRoadSnappedLocationProvider.allowsBackgroundLocationUpdates روی NO، اعلان‌های پس‌زمینه را برای مکان‌های ثبت‌شده در جاده غیرفعال کنید.

برای غیرفعال کردن پردازش پس‌زمینه برای سایر اعلان‌های موقعیت مکانی، تابع GMSNavigator.sendsBackgroundNotifications(NO) را فراخوانی کنید.

شخصی‌سازی رابط کاربری

آیا می‌توانم بهترین گزینه مسیر را با رنگ مشخص کنم؟
خیر. در حال حاضر امکان رنگ‌آمیزی یک مسیر خاص پشتیبانی نمی‌شود.
آیا SDK ناوبری می‌تواند زمان تقریبی رسیدن به مقصد نهایی را نشان دهد؟

بله. در اندروید، از روش‌های زیر استفاده کنید:

  1. با استفاده از Navigator.getTimeAndDistanceList() زمان و مسافت را برای همه نقاط مسیر بازیابی کنید.
  2. با استفاده از NavigationFragment.setEtaCardEnabled(false) زمان رسیدن به نقطه‌ی مسیر فعلی را مخفی کنید.
  3. زمان تقریبی رسیدن به مقصد نهایی را رندر کنید.

در iOS از موارد زیر استفاده کنید:

  1. تابع GMSNavigator.routeLegs(read) را فراخوانی می‌کند.
  2. در آخرین مرحله، GMSNavigator.timeToNextDestination را فراخوانی کنید.
  3. با استفاده از MSMapView.settings.navigationFooterEnabled=NO تا FALSE، زمان تقریبی رسیدن به نقطه‌ی مسیر فعلی را مخفی کنید.
  4. زمان تقریبی رسیدن به مقصد نهایی را رندر کنید.
چگونه می‌توانم به‌روزرسانی‌های 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 برای دریافت اعلان‌ها هنگام تغییر مسیر یا توصیه مسیر جدید استفاده کنید:

  1. یک شنونده (listener) ثبت کنید که موقعیت دستگاه را در طول مسیر با استفاده از متد Navigator.setRouteChangedListener بررسی کند.
  2. کد را به رویداد فراخوانی (callback event handler)، onRouteChanged ، اضافه کنید:
    • ارسال پیام به کاربر برنامه با اطلاعات به‌روز شده ETA و فاصله.
    • مکان دستگاه را ردیابی کنید.
    • [اختیاری] سایر قابلیت‌های مورد نیاز برنامه خود را برای مدیریت زمانی که راننده از مسیر تعیین‌شده خارج شده است، اضافه کنید.

در iOS، از GMSNavigator و شنونده‌های آن برای دریافت اعلان‌ها هنگام تغییر مسیر یا توصیه مسیر جدید استفاده کنید:

  1. در کنترلر نمای نقشه، پروتکل GMSNavigatorListener و پروتکل GMSRoadSnappedLocationProviderListener را پیاده‌سازی کنید.
  2. پیاده‌سازی GMSNavigatorListener.navigatorDidChangeRoute
  3. با استفاده از ویژگی‌های routeLegs و currentRouteLeg از GMSNavigator به مسیر جدید دسترسی پیدا کنید.
آیا راننده می‌تواند بدون تکمیل مسیر از ناوبری خارج شود؟

بله. در اندروید، برای متوقف کردن ناوبری، متد 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 را فراخوانی می‌کند.

خدمات حمل و نقل

استفاده از کیت توسعه نرم‌افزار ناوبری (Navigation SDK) چه تفاوتی برای مشتریان سرویس‌های موبایل (Mobility Services) دارد؟

سرویس‌های تحرک پلتفرم نقشه‌های گوگل مجموعه‌ای از APIها و SDKها را برای کمک به پشتیبانی از نیازهای سازمانی برای کسب‌وکارهای حمل‌ونقل و لجستیک ارائه می‌دهند. برای مشتریان سرویس‌های تحرک، SDK ناوبری معمولاً همراه با سرویس‌های مرتبط برای بهینه‌سازی مسیر، ارسال، ردیابی وظایف، تجزیه و تحلیل ناوگان و موارد دیگر استفاده می‌شود. SDK ناوبری همچنین برای مشتریان سرویس‌های تحرک به صورت متفاوتی محاسبه می‌شود. برای اطلاعات بیشتر، به مستندات سرویس‌های تحرک مراجعه کنید.

محصولات مربوط به حمل و نقل فقط برای مشتریان منتخب در دسترس هستند. برای اطلاعات بیشتر با نماینده فروش خود تماس بگیرید.

چگونه می‌توانم تشخیص دهم که آیا مشتری خدمات حمل و نقل هستم؟
اگر مطمئن نیستید که آیا SDK ناوبری را به عنوان یک مشتری خدمات تحرک پیاده‌سازی می‌کنید یا خیر، به دنبال فراخوانی ReportBillableEvent در کد خود باشید. فقط مشتریان خدمات تحرک باید متد ReportBillableEvent فراخوانی کنند.

هزینه‌ی خدمات ناوبری (Navigation SDK) برای مشتریان خدمات حمل و نقل (Mobility Services) چگونه محاسبه می‌شود؟
برای مشتریان خدمات تحرک، صورتحساب و قیمت‌گذاری برای SDK ناوبری به توافق‌نامه خدماتی که با پلتفرم نقشه‌های گوگل دارید بستگی دارد. برای کسب اطلاعات در مورد تأیید صحت صورتحساب پیاده‌سازی خدمات تحرک، به اعتبارسنجی صورتحساب مراجعه کنید. برای اطلاعات بیشتر در مورد صورتحساب خدمات تحرک، با نماینده فروش خود تماس بگیرید.

کدام APIهای SDK ناوبری فقط باید توسط مشتریان سرویس‌های تحرک‌پذیری استفاده شوند؟

چندین API در کیت توسعه نرم‌افزار ناوبری (Navigation SDK) وجود دارد که فقط برای استفاده مشتریان سرویس‌های موبایلی (Mobility Services) در نظر گرفته شده‌اند و گوگل برای آنها بر اساس هر تراکنش هزینه دریافت می‌کند. اگر شما مشتری سرویس‌های موبایلی نیستید، روش‌های زیر بی‌فایده هستند:

اگر من مشتری سرویس‌های موبایلی باشم، آیا می‌توانم از پیاده‌سازی SDK ناوبری که مربوط به سرویس‌های موبایلی نیست نیز استفاده کنم؟

بله، مشتریان سرویس‌های موبایلی می‌توانند از هر دو پیاده‌سازی سرویس‌های موبایلی و غیرموبایلیِ Navigation SDK استفاده کنند. با این حال، شما فقط می‌توانید از یک نوع پیاده‌سازی در یک برنامه در یک زمان استفاده کنید. همچنین باید یک پروژه Google Cloud جدید، حساب پرداخت و کلید API ایجاد کنید، جدا از مواردی که با پیاده‌سازی سرویس‌های موبایلی خود استفاده می‌کنید. برای اطلاعات بیشتر، به مرور کلی تنظیمات Navigation SDK مراجعه کنید.

برای اطلاعات بیشتر در مورد استفاده از پیاده‌سازی SDK ناوبری بدون سرویس‌های حرکتی، از جمله انتقال برنامه از یک نوع پیاده‌سازی به نوع دیگر، با نماینده حساب گوگل خود تماس بگیرید.

توجه: اگر مشتری سرویس‌های تحرک نیستید و علاقه‌مند به کسب اطلاعات بیشتر در مورد مجموعه APIها و 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.showTermsAndConditionsDialog method 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 LocationListener continues 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 allowsBackgroundLocationUpdates to YES .

Yes. When a route is created or changed, the RouteChangeListener provides 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 arm64 to the Excluded Architectures for "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:

  1. Retrieve the time and distance for all waypoints using Navigator.getTimeAndDistanceList() .
  2. 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:

  1. Retrieve the legs in the journey using Navigator.getRouteSegments() .
  2. Call GMSNavigator.timeToNextDestination for each journey leg.
  3. Forward the time information to the client application as you do for the driver ETA.
Can the RoadSnappedLocationProvider be used to obtain the driver's current snapped location if navigation is not in the foreground?

Yes. In Android, the RoadSnappedLocationProvider runs in the background by default.

In iOS, to keep navigation running in the background, implement the listener for GMSRoadSnappedLocationProviderListener , and set the property allowsBackgroundLocationUpdates to TRUE .

Does the Navigation SDK support geofencing?

No. In the context of navigation, remainingTimeOrdistanceChangeListener has 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 .

  1. Set the threshold to determine the frequency of the callbacks.
  2. 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.didUpdateRemainingDistance to manage the distance between notifications.

Can I disable notifications when the Navigation app is in the background?

Yes. In Android, use Navigator.setHeadsUpNotificationEnabled to control notifications. This method has a boolean argument. FALSE disables notifications; TRUE enables notifications.

In iOS, disable background notification for road-snapped locations by setting GMSRoadSnappedLocationProvider.allowsBackgroundLocationUpdates to 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:

  1. Retrieve the time and distance for all waypoints using Navigator.getTimeAndDistanceList() .
  2. Hide the ETA of the current waypoint using NavigationFragment.setEtaCardEnabled(false) .
  3. Render the final destination ETA.

In iOS, use the following:

  1. Call GMSNavigator.routeLegs(read) .
  2. With the last leg, call GMSNavigator.timeToNextDestination .
  3. Hide the ETA of the current waypoint using MSMapView.settings.navigationFooterEnabled=NO to FALSE.
  4. Render the final destination ETA.
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 .
Which UI customizations are available for the header and footer cards?

In Android, you use StylingOptions to set the background color styling. To hide or show the header and footer, use the setHeaderEnabled and setFooterEnabled member functions of NavigationFragment .

In iOS, use GMSMapView.settings.navigationHeaderPrimaryBackgroundColor to set the background color styling. To hide or show the header and footer use navigationFooterEnabled and navigationHeaderEnabled properties of GMSUISettings .

مسیریابی

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 Marker with a custom title for the destination and the latitude/longitude. The Navigation SDK displays the custom title and the coordinates on the NavigationMap .

In iOS, you create and display a GMSMarker for the destination.

Can I use the Navigation SDK to track deviations from a defined path?

Yes. In Android, use Navigator.setRouteChangedListener to receive notifications when a route changes or a new route is recommended:

  1. Register a listener that checks the device position along the route using the Navigator.setRouteChangedListener method.
  2. 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 GMSNavigator and its listeners to receive notifications when a route changes or a new route is recommended:

  1. On the map's view controller, implement the GMSNavigatorListener protocol and the GMSRoadSnappedLocationProviderListener protocol.
  2. Implement GMSNavigatorListener.navigatorDidChangeRoute .
  3. Access the new route using routeLegs and currentRouteLeg properties of the GMSNavigator .
Can the driver exit navigation without completing the route?

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 simulateLocationsAlongNewRoute to simulate a journey that includes a route change. The simulateLocationsAlongExistingRoute method ignores changes to the existing route.

In iOS, use GMSLocationSimulator.simulateAlongNewRouteToDestinations to simulate a journey that includes a route change. If you don't anticipate any route changes, you can use GMSLocationSimulator.simulateLocationsAlongExistingRoute or GMSLocationSimulator.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) . The resume intent fires when the app user clicks the notification. Typically, the Navigator.startguidance(getIntent()) is called from the main Activity, which recalls the Activity when the app user clicks the notification.

خدمات حمل و نقل

How is using the Navigation SDK different for Mobility Services customers?

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.

How can I tell if I'm a Mobility Services customer?
If you're not sure if you're implementing the Navigation SDK as a Mobility Services customer, look for a ReportBillableEvent call in your code. Only Mobility Services customers should call the ReportBillableEvent method.

How is the Navigation SDK billed for Mobility Services customers?
For Mobility Services customers, billing and pricing for the Navigation SDK depend on the service agreement you have with Google Maps Platform. For information on verifying that your Mobility Services implementation is being billed correctly see Billing validation . For additional information about Mobility Services billing, contact your sales representative.

Which Navigation SDK APIs should only be used by Mobility Services customers?

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:

If I'm a Mobility Services customer, can I also use a non-Mobility Services implementation of the Navigation SDK?

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 .

،

سوالات متداول

جزئیات محصول

مسائل

شبکه

داده‌ها

شخصی‌سازی رابط کاربری

مسیریابی

شبیه‌ساز

گردش‌های کاری

خدمات حمل و نقل

جزئیات محصول

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.showTermsAndConditionsDialog method 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 LocationListener continues 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 allowsBackgroundLocationUpdates to YES .

Yes. When a route is created or changed, the RouteChangeListener provides 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 arm64 to the Excluded Architectures for "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:

  1. Retrieve the time and distance for all waypoints using Navigator.getTimeAndDistanceList() .
  2. 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:

  1. Retrieve the legs in the journey using Navigator.getRouteSegments() .
  2. Call GMSNavigator.timeToNextDestination for each journey leg.
  3. Forward the time information to the client application as you do for the driver ETA.
Can the RoadSnappedLocationProvider be used to obtain the driver's current snapped location if navigation is not in the foreground?

Yes. In Android, the RoadSnappedLocationProvider runs in the background by default.

In iOS, to keep navigation running in the background, implement the listener for GMSRoadSnappedLocationProviderListener , and set the property allowsBackgroundLocationUpdates to TRUE .

Does the Navigation SDK support geofencing?

No. In the context of navigation, remainingTimeOrdistanceChangeListener has 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 .

  1. Set the threshold to determine the frequency of the callbacks.
  2. 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.didUpdateRemainingDistance to manage the distance between notifications.

Can I disable notifications when the Navigation app is in the background?

Yes. In Android, use Navigator.setHeadsUpNotificationEnabled to control notifications. This method has a boolean argument. FALSE disables notifications; TRUE enables notifications.

In iOS, disable background notification for road-snapped locations by setting GMSRoadSnappedLocationProvider.allowsBackgroundLocationUpdates to 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:

  1. Retrieve the time and distance for all waypoints using Navigator.getTimeAndDistanceList() .
  2. Hide the ETA of the current waypoint using NavigationFragment.setEtaCardEnabled(false) .
  3. Render the final destination ETA.

In iOS, use the following:

  1. Call GMSNavigator.routeLegs(read) .
  2. With the last leg, call GMSNavigator.timeToNextDestination .
  3. Hide the ETA of the current waypoint using MSMapView.settings.navigationFooterEnabled=NO to FALSE.
  4. Render the final destination ETA.
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 .
Which UI customizations are available for the header and footer cards?

In Android, you use StylingOptions to set the background color styling. To hide or show the header and footer, use the setHeaderEnabled and setFooterEnabled member functions of NavigationFragment .

In iOS, use GMSMapView.settings.navigationHeaderPrimaryBackgroundColor to set the background color styling. To hide or show the header and footer use navigationFooterEnabled and navigationHeaderEnabled properties of GMSUISettings .

مسیریابی

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 Marker with a custom title for the destination and the latitude/longitude. The Navigation SDK displays the custom title and the coordinates on the NavigationMap .

In iOS, you create and display a GMSMarker for the destination.

Can I use the Navigation SDK to track deviations from a defined path?

Yes. In Android, use Navigator.setRouteChangedListener to receive notifications when a route changes or a new route is recommended:

  1. Register a listener that checks the device position along the route using the Navigator.setRouteChangedListener method.
  2. 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 GMSNavigator and its listeners to receive notifications when a route changes or a new route is recommended:

  1. On the map's view controller, implement the GMSNavigatorListener protocol and the GMSRoadSnappedLocationProviderListener protocol.
  2. Implement GMSNavigatorListener.navigatorDidChangeRoute .
  3. Access the new route using routeLegs and currentRouteLeg properties of the GMSNavigator .
Can the driver exit navigation without completing the route?

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 simulateLocationsAlongNewRoute to simulate a journey that includes a route change. The simulateLocationsAlongExistingRoute method ignores changes to the existing route.

In iOS, use GMSLocationSimulator.simulateAlongNewRouteToDestinations to simulate a journey that includes a route change. If you don't anticipate any route changes, you can use GMSLocationSimulator.simulateLocationsAlongExistingRoute or GMSLocationSimulator.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) . The resume intent fires when the app user clicks the notification. Typically, the Navigator.startguidance(getIntent()) is called from the main Activity, which recalls the Activity when the app user clicks the notification.

خدمات حمل و نقل

How is using the Navigation SDK different for Mobility Services customers?

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.

How can I tell if I'm a Mobility Services customer?
If you're not sure if you're implementing the Navigation SDK as a Mobility Services customer, look for a ReportBillableEvent call in your code. Only Mobility Services customers should call the ReportBillableEvent method.

How is the Navigation SDK billed for Mobility Services customers?
For Mobility Services customers, billing and pricing for the Navigation SDK depend on the service agreement you have with Google Maps Platform. For information on verifying that your Mobility Services implementation is being billed correctly see Billing validation . For additional information about Mobility Services billing, contact your sales representative.

Which Navigation SDK APIs should only be used by Mobility Services customers?

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:

If I'm a Mobility Services customer, can I also use a non-Mobility Services implementation of the Navigation SDK?

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 .