下面是摘自AndroidSDK官方文档(http://developer.android.com/guide/topics/wireless/wifip2p.html) Wi-Fi Direct allows Android 4.0 (API level 14) or later devices with the appropriate hardware to connect directly to each other via Wi-Fi without an intermediate access point. Using these APIs, you can discover and connect to other devices when each device supports Wi-Fi Direct, then communicate over a speedy connection across distances much longer than a Bluetooth connection. This is useful for applications that share data among users, such as a multiplayer game or a photo sharing application. The Wi-Fi Direct APIs consist of the following main parts: •Methods that allow you to discover, request, and connect to peers are defined in the WifiP2pManager class. •Listeners that allow you to be notified of the success or failure of WifiP2pManager method calls. When calling WifiP2pManager methods, each method can receive a specific listener passed in as a parameter. •Intents that notify you of specific events detected by the Wi-Fi Direct framework, such as a dropped connection or a newly discovered peer. You often use these three main components of the APIs together. For example, you can provide a WifiP2pManager.ActionListener to a call to discoverPeers(), so that you can be notified with the ActionListener.onSuccess() and ActionListener.onFailure() methods. A WIFI_P2P_PEERS_CHANGED_ACTION intent is also broadcast if the discoverPeers() method discovers that the peers list has changed. ------------------------------------------------------------分隔线------------------------------------------------------- 结构应该是这个样子的 感兴趣的童鞋可以去研究研究 |
小黑屋|管理员QQ:44994224|邮箱(t268studio@gmail.com)|Archiver|MCLOUDER
GMT+8, 2024-5-5 00:06 , Processed in 0.031090 second(s), 19 queries .
Powered by Discuz! X3.4
© 2001-2017 Comsenz Inc.