Skip to content Skip to sidebar Skip to footer

Nearby Connections 2.0: Advertiser Restarts, But Discoverer Connects Using Old Advertiser Id

I caught an interesting result Advertiser advertised its endpoint id 'wjys' Discoverer requested connection to 'wjys' Advertiser restarted (stopAllEndpoints, disconnect from Googl

Solution 1:

That's a bug. I've filed a ticket internally to get it fixed. If you stop advertising, you should not be connectable by anyone who saw the old advertisement. Let us know if you catch any other weird edge cases like this! :)

To understand why this bug happens, the following is a small part about how Connections works: The endpoint id is sent as a part of the advertisement, and it forms an id-mac address pair on the Discoverer side. When the Discoverer is told 'requestConnection', it tries to connect to the Mac address associated with the endpoint id. If the device has already stopped advertising, the discoverer will fail to connect, but the discoverer will retry internally a few times just to make sure. If the advertiser restarts advertising quickly enough, it becomes connectable again and the discoverer's retry may succeed (because the Bluetooth mac address never rotates). This is true even if the advertisement is different.

Post a Comment for "Nearby Connections 2.0: Advertiser Restarts, But Discoverer Connects Using Old Advertiser Id"