尝试使用特定PIN码设置连接:
WifiP2pConfig config = new WifiP2pConfig();
config.deviceAddress = assetWifiP2pDevice.deviceAddress;
config.wps.setup = WpsInfo.DISPLAY;
config.wps.pin = "00000000";
mManager.cancelConnect(mChannel, null);
mManager.connect(mChannel, config, new WifiP2pManager.ActionListener() {
@Override
public void onSuccess() {
}
@Override
public void onFailure(int reason) {
}
});
但是在弹出连接对话框中,我看到随机生成的PIN。
在没有任何对话的情况下设置引脚和自动连接的正确方法是什么?
答案 0 :(得分:1)
我通过将设置更改为WpsInfo.KEYPAD
来实现此功能WifiP2pConfig config = new WifiP2pConfig();
config.deviceAddress = assetWifiP2pDevice.deviceAddress;
config.wps.setup = WpsInfo.KEYPAD;
config.wps.pin = "00000000";
mManager.cancelConnect(mChannel, null);
mManager.connect(mChannel, config, new WifiP2pManager.ActionListener() {
@Override
public void onSuccess() {
}
@Override
public void onFailure(int reason) {
}
});