Open aramikg opened 1 month ago
Yeah. Noticed it too.
In my case it sometimes find devices other times it doesn't. Although it seems only the Browser device can find devices, the advertised device can't find other devices.
Yea, I have been trying to debug to see why for about 3 days now, not once has my browser found other devices... Thanks for the info.
Although it seems only the Browser device can find devices, the advertised device can't find other devices.
@aramikg this comment is correct, you can read more here https://github.com/ksenia312/nearby_service/issues/15#issuecomment-2408689707
@aramikg Hello, I see your question and I'm investigating to find a solution
I will return with answer as soon as I found
Thanks, yes I understand that the advertiser doesn't see the browser at first but again my case is the browser doesn't see the advertiser, I have tried multiple devices.
@aramikg Yes, I got the problem and I'm able to reproduce with your code I need more time to find what exactly goes wrong there
Very thanks for your effort and time, I'll try to find a solution as soon as possible!
@aramikg Hello, I found the problem! Your code definitely should work, the bug is inside my source code.
The call
_nearbyService.ios?.setIsBrowser(value: value);
is void
but in real life I use StreamController
inside and listener to it, so it takes some time to update isBrowser
value (under the hood of nearby service) after calling setIsBrowser()
.
I apologise for this and I will update the plugin with fix
Until the update, you can try to call await Future.delayed()
here:
if (isBrowser) {
nearbyService.ios?.setIsBrowser(value: true);
await Future.delayed(const Duration(milliseconds: 100));
print('::: starting browsing for peers');
await _browseForPeers();
} else {
nearbyService.ios?.setIsBrowser(value: false);
await Future.delayed(const Duration(milliseconds: 100));
print('::: starting discovering peers');
await _startDiscovering();
}
For me this fix is working
I'll update the plugin as soon as possible! Thanks for letting me know about the problem
@aramikg new version nearby_service 0.1.1 is available to test
If everything is okay now, we can close the issue
Question:
So I have the key in my info.plist for iOS, I'm setting isBrowser, I've asked for the permissions, and my devices are still not finding each other. One Device logs that it is advertised while the other logs that it's browsing but the list of devices keep coming back empty. Am I missing anything?
Code Snippet:
Provide any relevant code snippets where you are using the API
Your effort is appreciated 💗