تجربة التنقّل المخصّصة
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
توفّر حزمة تطوير البرامج (SDK) للتنقّل طرقًا مختلفة لدمج تجربة تنقّل في تطبيقك. توضّح هذه الصفحة المقصود بتجربة التنقّل المخصّصة وكيف تختلف عن تجارب التنقّل الأخرى المتاحة في حزمة تطوير البرامج (SDK) للتنقّل.
ما هي تجربة التنقّل المخصّصة؟
الطريقة الأساسية لتنفيذ حزمة Navigation SDK هي استخدام تجربة التنقّل من Google، والتي تتيح لك تضمين تجربة تنقّل مفصّلة تستخدم عناصر ومرئيات واجهة المستخدم التي توفّرها Google، وهي تشبه تجربة التنقّل في تطبيقات "خرائط Google". إذا كنت بحاجة إلى مرونة أكبر من تلك التي توفّرها تجربة التنقّل من Google، يمكنك تنفيذ تجربة تنقّل مخصّصة.
تشير تجربة التنقّل المخصّصة إلى أي شيء، بدءًا من إلغاء إرشادات الانعطاف تمامًا وتشغيل التنقّل كعملية في الخلفية فقط، وصولاً إلى عرض تجربة إرشادات مخصّصة للغاية على شاشة منفصلة عن الجهاز الذي يشغّل التنقّل. من خلال تجربة التنقّل المخصّصة، يطلب تطبيقك من Navigation SDK الحصول على خلاصة اتّجاهات مفصّلة، ثم توفّر عناصر واجهة المستخدم والمرئيات التي تظهر للمستخدم في تجربة التنقّل وتديرها. على الرغم من أنّ استخدام تجربة التنقّل من Google أسهل بشكل عام، يتيح لك إنشاء تجربة تنقّل مخصّصة المزيد من التخصيص.
عند إنشاء تجربة تنقّل مخصّصة، يطلب تطبيقك من حزمة Navigation SDK بدء التنقّل وتشغيله وإيقافه، وذلك باستخدام سير العمل التالي:
ابدأ التنقّل. كما هو الحال مع تجربة التنقّل في Google، تتضمّن تجربة التنقّل المخصّصة إنشاء مثيل للتنقّل وتحديد الوجهة. ومع ذلك، يمكنك تحقيق ذلك من خلال تجربة تنقّل مخصّصة، وذلك عن طريق إنشاء جلسة تنقّل أولاً باستخدام GMSNavigationService.createNavigationSession
، وهو عنصر غير تابع لواجهة المستخدم ويتضمّن حالة ويمكنه العمل مع وحدة تحكّم في العرض أو بدونها.
لمزيد من المعلومات، اطّلِع على تفاصيل حول خلاصة بيانات الاتجاهات خطوة بخطوة.
مشاهدة العرض التوضيحي: يتضمّن تنزيل حزمة تطوير البرامج (SDK) الخاصة بخدمة Navigation عرضًا توضيحيًا يمكنك تشغيله للاطّلاع على مثال لتجربة تنقّل تتنقّل بين الإرشادات المفصّلة من خلال التنقّل العادي وتجربة تنقّل تعرض فقط الموقع الجغرافي للجهاز وهو يتحرّك على طول خط متعدد الأضلاع على الطريق.
التنقل النشط في ما يلي فرق رئيسي آخر بين تجربة التنقّل التي توفّرها Google وتجربة التنقّل المخصّصة.
بدلاً من تسليم التوجيه إلى أداة إدارة الأحداث المضمّنة في Navigation SDK، يمكنك إعداد أداة معالجة لتلقّي توجيهات مفصّلة خطوة بخطوة من خلال تنفيذ البروتوكول GMSNavigatorListener
، ثم تنفيذ أدوات معالجة الأحداث. يتيح ذلك لتجربتك الاستجابة للأحداث الموضّحة في الاستماع إلى أحداث التنقّل.
إنهاء التنقّل وكما هو الحال مع تجربة التنقّل في Google، تتطلّب ميزة التنقّل المخصّص أيضًا إنهاء التنقّل بالطريقة الأنسب لتجربة التطبيق.
متى يمكنك استخدام تجربة تنقّل مخصّصة؟
يوضّح الجدول التالي بعض سيناريوهات التنقّل المخصّص.
مثال على سيناريو |
الخطوات العامة |
يجب تقديم إرشادات للسائقين على الأجهزة الصغيرة، مثل المركبات ذات العجلتين، على شكل نص فقط. |
أنشئ تطبيقًا للتنقّل وأعِدّ الإرشادات المفصَّلة للتنقّل كخلاصة بيانات لجهاز بشاشة صغيرة، مع تشغيل تطبيق التنقّل على هاتف السائق الجوّال خارج نطاق رؤيته المباشرة. |
تريد إتاحة تطبيقك كخدمة في السيارة للسائقين الذين يستخدمون Apple CarPlay. |
- إعداد خدمة السيارة
- إعداد مشروع Navigation SDK
- أنشئ أداة تنقّل إذا لم يسبق لك ذلك.
- إعداد أداة معالجة للحصول على إرشادات مفصّلة
- ارسم الخريطة على مساحة تطبيق السيارات واملأ الحقول من خلاصة البيانات التي أعددتها.
لمزيد من المعلومات، يُرجى الاطّلاع على تفعيل التنقّل في Carplay. |
يريد السائقون الذين يستخدمون تطبيقك الحصول على خريطة عامة لمعظم رحلتهم، مع توفير الحد الأدنى من الإرشادات المفصّلة للشوارع في المدينة. |
يجب أن يتيح تطبيقك للسائقين الدخول إلى تجربة التنقّل من Google والخروج منها حسب الحاجة، بدون تغيير إعدادات أداة التنقّل الخاصة بالوجهة ووضع الرحلة. |
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-08-31 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-31 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe Navigation SDK offers a custom navigation experience for greater flexibility beyond the standard Google navigation experience.\u003c/p\u003e\n"],["\u003cp\u003eCustom navigation involves managing UI elements and visuals, starting navigation sessions, listening for events, and ending navigation.\u003c/p\u003e\n"],["\u003cp\u003eCustom experiences are suitable for scenarios like text-only guidance, Carplay integration, or combining overview maps with minimal turn-by-turn guidance.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can access the turn-by-turn data feed and detailed navigation events to create highly customized navigation interfaces.\u003c/p\u003e\n"]]],[],null,["# Custom navigation experience\n\nThe Navigation SDK provides different ways to integrate a navigation\nexperience into your app. This page explains what a custom navigation experience\nis and how it differs from other navigation experiences that are available in\nthe Navigation SDK.\n\nWhat is a custom navigation experience?\n---------------------------------------\n\nThe primary way to implement the Navigation SDK is to use the [Google\nnavigation\nexperience](/maps/documentation/navigation/ios-sdk/intro-google-nav),\nwhich lets you embed a turn-by-turn navigation experience that uses\nGoogle-provided UI elements and visuals --- similar to the navigation experience\nwithin the Google Maps apps. If you need more flexibility than the Google\nnavigation experience offers, you can implement a custom navigation experience.\nA custom navigation experience refers to anything from eliminating turn guidance\nentirely with and running navigation only as a background process, to projecting\na highly customized guidance experience to a screen separate from the device\nthat runs the navigation. With a custom navigation experience, your app calls\nthe Navigation SDK to request a turn-by-turn navigation feed, and then\nyou provide and manage the UI elements and visuals that the user sees in the\nnavigation experience. While using the Google navigation experience is generally\neasier to implement, building your own custom navigation experience allows for\nmore customization.\n\nWhen you create a custom navigation experience, your app calls the Navigation\nSDK to start, run, and stop navigation, using the following flow:\n\n1. **Start navigation** . As with the Google navigation experience, a custom\n navigation experience still involves creating a navigation instance and\n setting the destination. However, with a customized navigation experience,\n you achieve this by first establishing a navigation session using\n `GMSNavigationService.createNavigationSession`, which is a state-bearing\n non-UI object that can operate either with a view controller, or without\n one.\n\n \u003cbr /\u003e\n\n For more information, see [Details about the turn-by-turn data\n feed](/maps/documentation/navigation/ios-sdk/nav-only-feed).\n\n **See the demo:** The download of the Navigation SDK contains a demo\n you can run to see an example of a navigation experience that switches\n between turn-by-turn guidance through standard navigation to a navigation\n experience that shows only the device location moving along a road\n polyline.\n2. **Active navigation** . Here is another key difference between a\n Google-provided navigation experience and a custom navigation experience.\n Instead of handing off guidance to the built-in event manager of the\n Navigation SDK, you set up a listener for detailed turn-by-turn guidance by implementing the `GMSNavigatorListener` protocol, and then implement event\n handlers. This allows your experience to respond to the events described in\n [Listen for navigation\n events](/maps/documentation/navigation/ios-sdk/events).\n\n3. **End navigation**. As with the Google navigation experience, custom\n navigation also requires you to terminate navigation in the manner best\n suited for the app's experience.\n\nWhen might you use a custom navigation experience?\n--------------------------------------------------\n\nThe following table describes some custom navigation scenarios.\n\n| **Example scenario** | **High-level steps** |\n|----------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| You need to provide text-only driver guidance for small devices such as 2-wheeled vehicles. | Create your navigator and set up the turn-by-turn guidance as a data feed to a small screen device while the navigator runs on the driver's mobile phone outside of their immediate view. |\n| You want to make your app available as a car service for drivers who use Apple Carplay. | 1. Set up the car service. 2. Set up your Navigation SDK project. 3. Establish a navigator if you haven't already. 4. Set up a listener for turn-by-turn guidance. 5. Draw the map on the auto app surface and populate the fields from the data feed you configured. For more information, see [Enable Navigation for Carplay](/maps/documentation/navigation/ios-sdk/carplay) |\n| Drivers using your app want an overview map for most of their journey, with only minimal turn-by-turn guidance for city streets. | Your app should allow drivers to enter and exit the Google navigation experience as they need, without alternating the navigator's settings for destination and trip mode. |"]]