Wifi Direct:多久召唤同伴发现?
-
26-12-2019 - |
题
我正在开发一个p2p应用程序,并按照教程在这里虽然我在2部手机上测试它,我在徘徊我什么时候必须启动对等体发现?
仅在App启动时,定期或每次在onResume
中启动时?
我在询问,因为有时候我试图显示对等体列表的时,它找不到任何东西。我也想知道这个问题,并且是什么是对等发现的,它在做什么。
其他提示
mManager.discoverPeers(mChannel, new WifiP2pManager.ActionListener() {
@Override
public void onSuccess() {
Toast.makeText(MainActivity.this, "onSuccess", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int reasonCode) {
switch(reasonCode){
case WifiP2pManager.ERROR:
Toast.makeText(MainActivity.this, "Getting error while peers discover", Toast.LENGTH_SHORT).show();
break;
case WifiP2pManager.P2P_UNSUPPORTED:
Toast.makeText(MainActivity.this, "Device is not supported", Toast.LENGTH_SHORT).show();
break;
case WifiP2pManager.BUSY:
Toast.makeText(MainActivity.this, "Device is busy", Toast.LENGTH_SHORT).show();
break;
}
}
});
. 不隶属于 StackOverflow