WiFi Direct for multiple devices

若如初见. 提交于 2019-12-01 08:44:34

Since B is the group owner(GO) and A and C are clients, B can get clients' address by the callback function of WifiP2pManager.requestGroupInfo() .

Request group info after connected like this.

mWifiP2pManager.requestGroupInfo(mChannel,new WifiP2pManager.GroupInfoListener() {
        @Override
        public void onGroupInfoAvailable(WifiP2pGroup wifiP2pGroup) {
            Collection<WifiP2pDevice> peerList = wifiP2pGroup.getClientList();
            ArrayList<WifiP2pDevice> list = new ArrayList<WifiP2pDevice>(peerList);
            String host;
            for (int i = 1; i < list.size(); i++) {
                host = list.get(i).deviceAddress;
                /** transferFile here **/
            }
        }
    });
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!