ワイヤレスでデバイスに接続する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Android のワイヤレス API は、クラウドとの通信を可能にするだけでなく、
同じローカル ネットワーク上の他のデバイスとの通信を可能にする
ネットワーク上には存在せず、物理的に近くにあるデバイスネットワーク サービス ディスカバリ(NSD)の追加により、アプリは、通信可能なサービスを実行している近くのデバイスを検索できるようになります。この機能をアプリに統合すると、幅広い機能を提供するのに役立ちます。たとえば、同じ部屋にいるユーザーとゲームをプレイしたり、ネットワークに接続された NSD 対応のウェブカメラから画像を取得したり、同じネットワーク上にある他のマシンにリモートでログインしたりできます。
このクラスでは、アプリから他のデバイスを見つけて接続するための主要な API について説明します。具体的には、検出機能を提供する NSD API を
ピアツーピア(P2P)API を使用してピアツーピア通信を
ワイヤレス接続です。また、NSD と Wi-Fi P2P を組み合わせて使用することにより、デバイスが提供するサービスを検出して、どちらのデバイスもネットワークに接続していないときにデバイスに接続する方法を示します。
Wi-Fi と Bluetooth の組み合わせによりデバイス間でデータを確実かつ安全に転送する Android アプリ用の高度な API を探している場合は、Nearby Connections API の使用をご検討ください。
レッスン
- ネットワーク サービス ディスカバリを使用する
- 提供されるブロードキャスト サービスの詳細
ローカル ネットワークで提供されているサービスを検出し、
NSD を使用して、必要なサービスの接続の詳細を決定します。
接続します。
- Wi-Fi で P2P 接続を作成する
- Google Chat で
ピアデバイスを作成して、レガシー デバイスのアクセス ポイントを作成し、
Wi-Fi P2P 接続に対応している他のデバイスに接続できます
- サービス ディスカバリに Wi-Fi P2P を使用する
- Wi-Fi P2P を使用して、同じネットワーク上にない近くのデバイスが公開しているサービスを検出する方法を学びます。
関連ドキュメント
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-26 UTC。
[[["わかりやすい","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 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)"]]