I am using WiFiDirect to connect my android device to another device using WiFiDirect.
I have the following method to get the host IP address which works great when device is not the group owner.
public String getDestinationDeviceIpAddress(WifiP2pInfo wifiP2pInfo) {
String destinationAddress;
if (wifiP2pInfo.isGroupOwner) {
destinationAddress = // How to get the address here ???
} else {
// This works great !
destinationAddress = wifiP2pInfo.groupOwnerAddress.getHostAddress();
}
return destinationAddress;
}
Question:
How do I get the peer's address for the case where wifiP2pInfo.isGroupOwner
is true? In other words, how to get the peer's address when the android device is the Group Owner(GO)?
Android sdk version:
Targeting android sdk version 28 and above