Nearby Connections 2.0: When is simultaneous adver

2019-07-27 17:52发布

问题:

I'm currently trying to simultaneously advertise and discover using the P2P_CLUSTER strategy. I believe that this should work, since the available documentation says the P2P_CLUSTER strategy supports M-N connection topology (where each device can both initiate outgoing connections to M other devices and accept incoming connections from N other devices). However, the same documentation also says that it's possible to simultaneously advertise and discover using the P2P_STAR strategy. So simultaneous advertising/discovery would seem to be possible with all strategies? But I wonder about this, because I also read the following note on a different documentation page:

Note: depending on the Strategy, it's possible to advertise and discover at the same time on a device.

So does the ability to simultaneously advertise and discover depend on the Strategy? and if so, how?

回答1:

Right now, all strategies can advertise + discover at the same time. There was a time (pre-release) when that wasn't true, and the wording was left that way in case we ever added a new strategy that can't do both.

That said, the note is confusing given the current state of things. I'll get someone to remove it.