0

First of all,

Decive A and B both enable wifi-direct.

Then,

There shows up a dialog on device B, when device A tries to connect device B.

The words on that dialog :

<string name="wifi_p2p_pbc_go_negotiation_request_message">Wi-Fi Direct connection setup request from <xliff:g id="p2p_device_address">%1$s</xliff:g>. Click OK to accept. </string>

It shows the decive-mac-address of A, if I want to show the device-name of A, how can I do?

Cause I can get the name of A in the device list, which is a prefrence.

=====================

Here comes the decive-mac-address of A, from class wifip2pconfig.

WifiP2pService.java (frameworks\base\wifi\java\android\net\wifi\p2p)

private void notifyP2pGoNegotationRequest(WifiP2pConfig config {

    //... ...

    dialog.setMessage(r.getString(R.string.wifi_p2p_pin_go_negotiation_request_message,
                    config.deviceAddress));

    //... ...

}

WifiP2pConfig.java (frameworks\base\wifi\java\android\net\wifi\p2p)

public WifiP2pConfig(String supplicantEvent) throws IllegalArgumentException {  

    //... ...

    String[] tokens = supplicantEvent.split(" ");

    deviceAddress = tokens[1];   

    //... ...
}
leiyu
  • 11
  • 4

1 Answers1

0

Referring to Wifi-Direct API, when the peer is discovered, for each WifiP2pDevice you can get the device name.

songyy
  • 4,323
  • 6
  • 41
  • 63