首先,
决定A和B都启用wifi-direct。
然后,
当设备A尝试连接设备B时,设备B上会显示一个对话框。
该对话框上的文字:
<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>
它显示A的decive-mac-address,如果我想显示A的设备名,我该怎么办?
因为我可以在设备列表中获得A的名称,这是一个优先选择。
=====================
这是来自类wifip2pconfig的A的decive-mac-address。
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];
//... ...
}