La connexion Wi-Fi Direct adresse mac va être différent. Il est expliqué magnifiquement par @auselen ici https://stackoverflow.com/a/14480530/3167704.
Je viens de comprendre un moyen de récupérer WiFi Direct adresse mac. Ce n'est pas joli mais fait le travail. Voici le code,
final WifiP2pManager p2pManager = (WifiP2pManager) getSystemService(WIFI_P2P_SERVICE);
final WifiP2pManager.Channel channel = p2pManager.initialize(this, getMainLooper(), null);
p2pManager.createGroup(channel, new WifiP2pManager.ActionListener() {
@Override
public void onSuccess() {
p2pManager.requestGroupInfo(channel, new WifiP2pManager.GroupInfoListener() {
@Override
public void onGroupInfoAvailable(WifiP2pGroup wifiP2pGroup) {
Log.i("", wifiP2pGroup.getOwner().deviceAddress);
// Following removal necessary to not have the manager busy for other stuff, subsequently
p2pManager.removeGroup(channel, new WifiP2pManager.ActionListener() {
@Override
public void onSuccess() {
Log.i("", "Removed");
}
@Override
public void onFailure(int i) {
Log.i("", "Failed " + i);
}
});
}
});
}
@Override
public void onFailure(int i) {
Log.i("", String.valueOf(i));
}
});
Nooon ... C'est juste trop laid ... * soupir *. Il doit y avoir une autre façon ... –