flutter_nsd
flutter_nsd copied to clipboard
Services are not discovered on Android
Using this in a flutter app for iOS and Android. While it works as expected on iOS, it does not discover the services on Android. This is on Android 14 (Samsung Galaxy A34 5G)
Here is some logcat output, the code runs for 30 seconds, apparently something is found by MdnsDiscoveryManager, but not returned to the stream:
2024-05-25 12:04:23.842 25445-25493 flutter ch.msys.trx_control I trx-control: start discovery
2024-05-25 12:04:23.845 1501-1798 serviceDiscovery system_server I [MdnsDiscoveryManager] Registering listener for serviceType: _trx-control._tcp.local
2024-05-25 12:04:24.948 1501-1798 serviceDiscovery system_server I [MdnsDiscoveryManager._trx-control._tcp.local-104/40] Handling response from service: trx-control (trxd) on trx-control-w2, newServiceFound: false, serviceBecomesComplete: false, responseIsComplete: true
2024-05-25 12:04:53.856 25445-25493 flutter ch.msys.trx_control I trx-control: stop discovery
2024-05-25 12:04:53.860 1501-1798 serviceDiscovery system_server I [MdnsDiscoveryManager] Unregistering listener for serviceType:_trx-control._tcp.local
I turns out that the service name matters. If I try to discover "_trx-control._tcp" it is found on iOS, but not on Android. If I add a dot ("_trx-control._tcp.") then it is discovered on iOS and Android. This is weird, and maybe worth mentioning in the docs?