WiFi Direct for multiple devices

前端 未结 1 563
盖世英雄少女心
盖世英雄少女心 2021-01-14 09:27

I am trying to establish file transfer (between 3 devices) through Wifi Direct from the tutorial given in

http://developer.android.com/training/connect-devices-wire

相关标签:
1条回答
  • 2021-01-14 09:39

    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 **/
                }
            }
        });
    
    0 讨论(0)
提交回复
热议问题