Connect devices wirelessly
Stay organized with collections
Save and categorize content based on your preferences.
Besides enabling communication with the cloud, Android's wireless APIs also
enable communication with other devices on the same local network, and even
devices which are not on a network, but are physically nearby. The addition of
Network Service Discovery (NSD) takes this further by allowing an application to
seek out a nearby device running services with which it can communicate.
Integrating this feature into your application helps you provide a wide range of
features, such as playing games with users in the same room, pulling images from
a networked NSD-enabled webcam, or remotely logging into other machines on the
same network.
This class describes the key APIs for finding and connecting to other devices
from your application. Specifically, it describes the NSD API for discovering
available services and the Wi-Fi Peer-to-Peer (P2P) API for doing peer-to-peer
wireless connections. This class also shows you how to use NSD and Wi-Fi P2P in
combination to detect the services offered by a device and connect to the device
when neither device is connected to a network.
If you're looking for a higher-level API for your Android application to
transfer data reliably and securely between devices using a combination of Wi-Fi
and Bluetooth, consider using the Nearby Connections API.
Lessons
- Use network service discovery
- Learn how to broadcast services offered
by your own application, discover services offered on the local network, and
use NSD to determine the connection details for the service you want to
connect to.
- Creating P2P connections with Wi-Fi
- Learn how to fetch a list of
nearby peer devices, create an access point for legacy devices, and connect
to other devices capable of Wi-Fi P2P connections.
- Using Wi-Fi P2P for service discovery
- Learn how to discover services
published by nearby devices without being on the same network, using Wi-Fi
P2P.
You should also read
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-10-17 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-17 UTC."],[],[],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)"]]