我有2个P2P设备(Android智能手机)。他们创建了一个Wifi Direct Group。因此,我们有一个集团所有者和一个客户。出现第三个设备,并且想要加入向GO发送连接请求的组。发生这种情况时,GO BroadcastReceiver会检测到断开连接。我想知道这是正常行为还是我做错了。
这是我的BroadcastReceiver
的一部分else if (WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION
.equals(action)) {
if (manager == null) {
return;
}
NetworkInfo networkInfo = (NetworkInfo) intent
.getParcelableExtra(WifiP2pManager.EXTRA_NETWORK_INFO);
WifiP2pInfo wifiP2pInfo = (WifiP2pInfo) intent
.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_INFO);
WifiP2pGroup wifiP2pGroup = (WifiP2pGroup) intent
.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_GROUP);
if (networkInfo.isConnected()) {
// we are connected with the other device, request connection
// info to find group owner IP
} else {
// It's a disconnect
}
} else if ....