celdridge91190
celdridge91190

Reputation: 121

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?

Upvotes: 5

Views: 142

Answers (1)

Dr.Jukka
Dr.Jukka

Reputation: 2396

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.

Upvotes: 1

Related Questions