I am trying to develop an application using wifi direct in android Jelly Bean 4.1.1. If p2p is enabled, I immediately call
mManager.discoverPeers(mChannel, actionListener);
After that, I return to
onPeersAvailable(WifiP2pDeviceList)
I am testing 2 Samsung (Google) Nexus devices, and Wi-Fi Direct is enabled on both. But this callback returns an empty peer list. But, for example, if I click the Search Peers button on the direct wifi interface by default, then the second device starts immediately
WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION
and this inturn call
onPeersAvailable(WifiP2pDeviceList peers)
as I request for peers for this event using
mManager.requestPeers(mChannel, WifiDirectService.this);
This time I can see my peers. I see this several times.
What could be the reason? Thanks
source share