Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Android Wi-Fi Direct only return one service at a time with discoverServices?

When you call discoverPeers in Wi-Fi Direct, it returns a list of peers to the onPeersAvailable method in the PeerListListener (once you call requestPeers). However, when you call discoverServices, you only get one service at a time to the onDnsSdServiceAvailable method in the DnsSdServiceResponseListener. Does anyone know if there is a way to change this and get all services available at a given time? Or if there is a particular reason why it can only return one at a time?

like image 503
celdridge91190 Avatar asked Nov 09 '22 16:11

celdridge91190


1 Answers

As far as I know there is no ways on changing this. They are just given one by one, and the timing is not really set either.

All and all, the suggested way on handling getting them all is to implement a timer, which is reset every time you get a discovery, and it is fires before it gets discovery, you would determine that all peer services have been discovered. Sucks, but that's the way it works.

like image 83
Dr.Jukka Avatar answered Nov 14 '22 22:11

Dr.Jukka