I am trying to develop an app using wifi direct in android Jelly Bean 4.1.1. If p2p is enabled I immedialtely call
mManager.discoverPeers(mChannel, actionListener);
After that I am getting a call back to the
onPeersAvailable(WifiP2pDeviceList)
I am testing with 2 Samsung(Google) Nexus device and wifi direct is turned on on both. But this call back is returning an empty list of peers. But for instance if I click on the Search Peers button on the default wifi direct interface immedialtely the second device fires the
WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION
and this inturn calls
onPeersAvailable(WifiP2pDeviceList peers)
as I am requesting for peers for that event using
mManager.requestPeers(mChannel, WifiDirectService.this);
This time I will be able to see the peers. I am seeing this for a number of times.
What could be the possible reason? Thanks