Open mugetsu2012 opened 7 months ago
Tagging subscribers to this area: @dotnet/ncl See info in area-owners.md if you want to be subscribed.
/cc @simonrozsival @vitek-karas
@mugetsu2012 unfortunately, this API is fairly limited on Android. I would recommend using MAUI's Connectivity helpers (see https://learn.microsoft.com/dotnet/maui/platform-integration/communication/networking?tabs=android) or alternatively Android's platform APIs (see https://learn.microsoft.com/en-us/dotnet/api/android.net.connectivitymanager.requestnetwork?view=xamarin-android-sdk-13 and the official Android documentation for more details).
@vitek-karas we tried fixing NetworkInterface
APIs on Android in .NET 7 to make them more reliable but they are still very limited and unreliable. In "recent" releases, Android's unix networking APIs were either removed, or limited in some other way. The Android APIs aren't 1:1 to the .NET APIs so we didn't use those. We should either revisit this area or we might consider deprecating these APIs completely and guiding customers to use the MAUI Connectivity APIs instead.
Description
When trying to get the current available networks using
NetworkInterface.GetAllNetworkInterfaces()
on Adroid, we are gettingUnknown
for theNetworkInterfaceType
property instead of a real valueReproduction Steps
NetworkInterface.GetAllNetworkInterfaces()
and check that we don't have a WirelessNetworkInterfaceType
but instead we haveUnknown
Expected behavior
When using
NetworkInterface.GetAllNetworkInterfaces()
the properyNetworkInterfaceType
should be populated correctly to reflect a Wireless network interfaceActual behavior
When using
NetworkInterface.GetAllNetworkInterfaces()
the properyNetworkInterfaceType
is being set toUnknown
Regression?
First time
Known Workarounds
None
Configuration
Other information
Possibly related to: https://github.com/dotnet/runtime/issues/99721