inconsistency in getting WifiP2pInfo in WiFiDirect

不想你离开。 提交于 2020-01-14 05:17:14

问题


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

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) {

             }

};

回答1:


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 :)



来源:https://stackoverflow.com/questions/28252866/inconsistency-in-getting-wifip2pinfo-in-wifidirect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!