矛盾在Wi-Fi直连获得WifiP2pInfo矛盾、Wi、WifiP2pInfo、Fi

2023-09-07 00:57:15 作者:浮云过影

我创建基于 Wi-Fi直连 Android中,但一个应用程序,我在获得无线点到点的连接信息不一致面临的问题。

我检查是否Wi-Fi直连是或不是,它显示出其真实的,但还是有时我得到的连接信息,有时不和这就是为什么我没有得到的原因 groupOwnerAddress

一件事是,我得到 networkInfo.isConnected()到时候只有我不能够获得 WifiP2pInfo 。有时工作有时不pretty frustratio

  wifiManager.requestConnectionInfo(wifiChannel,新ConnectionInfoListener(){            @覆盖            公共无效onConnectionInfoAvailable(WifiP2pInfo资讯){             }}; 

解决方案

对不起,我不明白你的问题完全,你可以发布一个逐步的说明重现你的问题?

我发现这个网站非常有用:的http://developer.android.com/training/connect-devices-wirelessly/wifi-direct.html

一定要检查 info.groupFormed 真正,使用前 info.isGroupOwner info.groupOwnerAddress

onConnectionInfo 可在任何时候被调用,但只有当 info.groupFormed 真正它包含有用的信息。

希望这有助于:)

i am creating an application based on WifiDirect in android but the issue that i am facing inconsistency in getting wifi p2p connection info.

新一代WIFI来了 谷歌申请进行6GHz WiFi测试,2022年有望普及

i am checking whether wifi direct is on or not , it shows its true but still sometimes i am getting connection info and sometimes not and thats the reason why i am not getting groupOwnerAddress.

one more thing is that i get networkInfo.isConnected() to false and that time only i am not able to get the WifiP2pInfo. sometimes it works sometimes it doesn't pretty frustratio

wifiManager.requestConnectionInfo(wifiChannel, new ConnectionInfoListener(){

            @Override
            public void onConnectionInfoAvailable(WifiP2pInfo info) {

             }

};

解决方案

Sorry, I do not understand your question entirely, could you post a step-wise instructions to reproduce your problem?

I found this website very useful: http://developer.android.com/training/connect-devices-wirelessly/wifi-direct.html

Be sure to check info.groupFormed is true, before using info.isGroupOwner and info.groupOwnerAddress

onConnectionInfo may be called at any time, but only when info.groupFormed is true it contains useful information.

Hope this helps :)