问题
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