Created attachment 17463 [details]
Sample App for Repro
Multicast DNS discovery has worked flawlessly on all Android platforms up until 7.0 (API 24). On Android 7.0, every single network interface reports back false, whereas on previous versions, the WIFI connection reports back true.
A sample application which can reproduce the issue is attached. This sample Xamarin.Android app enumerates all the interfaces using System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(). And for each interface returned, it checks the SupportsMulticast property. This property returns false for every network interface when the app is run on Android 7 devices.
Created attachment 17464 [details]
Screenshot on Android 7.0 device
Created attachment 17465 [details]
Screenshot on Android 5.0 device
As you can see here WLAN0 returns TRUE
Created attachment 17471 [details]
Created attachment 17472 [details]
Created attachment 17473 [details]
From a customer:
"We have found that Bonjour browsing unexpectedly stops working on Android 7.0. After the investigation we’ve discovered, that the issue was related to usage of Wi-Fi network interface in general and it was caused by the changes in system WifiManager API.
To address the issue are now using the ConnectivityManager API.
We were using the WiFiManager API to get the WiFi MAC address to pick the proper network for mDNS search.
Starting in Android 6.0 the programmatic access to the WiFi MAC address was disable, thusly the WiFiManager doesn’t report the actual identifier. In Android 6.0 we had mechanism to use the first non-loopback interface if no interfaces were found with the current MAC. This would happen on Android 6.0. For Android 7.0 the first loopback network interface is a fake, so it now fails.
Because of this we moved to the ConnectivityManager API for Android 5+ devices. We can detect the WiFI interface without knowing the MAC address.
I don’t know how the lower level networking is handled by the Xamarin libraries, but from the behaviors exhibited I would assume it is similar. I’m passing this along in hopes that it will speed up the fix for the defect that we are waiting on for a fix."
The original issue happens because Google disabled access to some files in the /sys/class/net/[INTERFACE] files (for instance "flags", "operstate") which are what we use to determine the status of the interface including its multicast capability.
I'm working on a different way to obtain the information from the system.
Relevant upstream bug https://code.google.com/p/android/issues/detail?id=205565
PRs with a fix/workaround are up: https://github.com/xamarin/xamarin-android/pull/261 and https://github.com/xamarin/monodroid/pull/522 - once those are accepted another PR, this time for Mono, will be opened and complete the fix for this issue.
Alas, we won't be able to obtain arbitrary interface MAC - even Java classes can't provide us with the information.
Mono PR https://github.com/mono/mono/pull/3781
With the acceptance of the above (and its backport to mono 4.8 in commit 1db9061145385d28dc6ce5cbda768bdefe406b16) the bug is fixed.
Notice (2018-05-21): bugzilla.xamarin.com will be
switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.
Please join us on
Visual Studio Developer Community and
GitHub to continue tracking
issues. Bugzilla will remain available for reference in read-only mode.
We will continue to work on open Bugzilla bugs and copy them to the new
locations as needed for follow-up. The See Also field
on each Bugzilla bug will be updated with a link to its new location
After Bugzilla is read-only, if you have new information to add for a
bug that does not yet have a matching issue on Developer Community or
GitHub, you can create a follow-up issue in the new location. Copy and
paste the title and description from this bug, and then add your new
details. You can get a pre-formatted version of the title and
In special cases you might also want the comments:
Our sincere thanks to everyone who has contributed on this bug tracker
over the years. Thanks also for your understanding as we make these
adjustments and improvements for the future.