توصيل الأجهزة لاسلكيًا
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
بالإضافة إلى توفير إمكانية الاتصال بالسحابة الإلكترونية، توفر واجهات برمجة التطبيقات اللاسلكية في Android أيضًا
وتتيح الاتصال بالأجهزة الأخرى على الشبكة المحلية نفسها، بالإضافة إلى
أجهزة ليست متصلة بأي شبكة ولكنها قريبة فعليًا. تؤدي إضافة ميزة
Network Service Discovery (NSD) إلى تعزيز ذلك من خلال السماح للتطبيق بمحاولة
العثور على جهاز مجاور يعمل بخدمات يمكنه التواصل معها.
يساعدك دمج هذه الميزة في تطبيقك على توفير مجموعة كبيرة من
الميزات، مثل تشغيل ألعاب مع المستخدمين في الغرفة نفسها أو سحب الصور من
كاميرا ويب مزوّدة بتقنية NSD على الشبكة أو تسجيل الدخول عن بُعد إلى أجهزة أخرى على
الشبكة نفسها.
تصف هذه الفئة واجهات برمجة التطبيقات الرئيسية للبحث عن الأجهزة الأخرى والاتصال بها.
من تطبيقك. ويوضّح هذا القسم تحديدًا واجهة برمجة التطبيقات NSD API لاكتشاف
الخدمات المتاحة وواجهة برمجة التطبيقات Wi-Fi Peer-to-Peer (P2P) API لإجراء اتصالات لاسلكية بين الأجهزة المشابهة
. توضّح لك هذه الفئة أيضًا كيفية استخدام NSD وWi-Fi P2P معًا
لرصد الخدمات التي يوفّرها أحد الأجهزة والاتصال بالجهاز
عندما لا يكون أي من الجهازَين متصلاً بشبكة.
إذا كنت تبحث عن واجهة برمجة تطبيقات ذات مستوى أعلى لتطبيق Android
لنقل البيانات بشكل موثوق وآمن بين الأجهزة باستخدام شبكة Wi-Fi
والبلوتوث، يمكنك استخدام واجهة برمجة تطبيقات الاتصالات المجاورة.
دروس
- استخدام ميزة اكتشاف خدمة الشبكة
- التعرّف على كيفية بث خدمات البث المعروضة
من خلال تطبيقك الخاص، واكتشاف الخدمات المعروضة على الشبكة المحلية،
استخدام NSD لتحديد تفاصيل الاتصال للخدمة التي تريد
الاتصال بها.
- إنشاء اتصالات بين الأجهزة باستخدام شبكة Wi-Fi
- التعرّف على كيفية استرجاع قائمة
أجهزة مشابهة قريبة، وإنشاء نقطة وصول للأجهزة القديمة، والاتصال
على الأجهزة الأخرى التي يمكنها إجراء اتصالات Wi-Fi من الند للند (P2P)
- استخدام تقنية Wi-Fi P2P لاكتشاف الخدمات
- التعرّف على كيفية اكتشاف الخدمات
تم نشرها بواسطة الأجهزة المجاورة بدون الاتصال بالشبكة نفسها، باستخدام Wi-Fi
من P2P.
ننصحك أيضًا بقراءة
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Connect devices wirelessly\n\nBesides enabling communication with the cloud, Android's wireless APIs also\nenable communication with other devices on the same local network, and even\ndevices which are not on a network, but are physically nearby. The addition of\nNetwork Service Discovery (NSD) takes this further by allowing an application to\nseek out a nearby device running services with which it can communicate.\nIntegrating this feature into your application helps you provide a wide range of\nfeatures, such as playing games with users in the same room, pulling images from\na networked NSD-enabled webcam, or remotely logging into other machines on the\nsame network.\n\nThis class describes the key APIs for finding and connecting to other devices\nfrom your application. Specifically, it describes the NSD API for discovering\navailable services and the Wi-Fi Peer-to-Peer (P2P) API for doing peer-to-peer\nwireless connections. This class also shows you how to use NSD and Wi-Fi P2P in\ncombination to detect the services offered by a device and connect to the device\nwhen neither device is connected to a network.\n\nIf you're looking for a higher-level API for your Android application to\ntransfer data reliably and securely between devices using a combination of Wi-Fi\nand Bluetooth, consider using the [Nearby Connections API](https://developers.google.com/nearby/connections/overview). \n\nLessons\n-------\n\n**[Use network service discovery](/develop/connectivity/wifi/use-nsd)**\n: Learn how to broadcast services offered\n by your own application, discover services offered on the local network, and\n use NSD to determine the connection details for the service you want to\n connect to.\n\n**[Creating P2P connections with Wi-Fi](/develop/connectivity/wifi/wifi-direct)**\n: Learn how to fetch a list of\n nearby peer devices, create an access point for legacy devices, and connect\n to other devices capable of Wi-Fi P2P connections.\n\n**[Using Wi-Fi P2P for service discovery](/develop/connectivity/wifi/nsd-wifi-direct)**\n: Learn how to discover services\n published by nearby devices without being on the same network, using Wi-Fi\n P2P.\n\nYou should also read\n--------------------\n\n- [Wi-Fi P2P](/develop/connectivity/wifi/wifip2p)\n- [Nearby Connections API](https://developers.google.com/nearby/connections/overview)"]]