Home > database >  Possible Android hotspot interface names
Possible Android hotspot interface names

Time:12-13

Is there any way to get the name of the interface working for WiFi hotspot? I have seen that there are many names e.x ap0, swlan0 etc.

Anybody knows other names or a way to find it easily?

CodePudding user response:

Try below.

for(Enumeration<NetworkInterface> networkInterfaceList = NetworkInterface.getNetworkInterfaces(); networkInterfaceList.hasMoreElements();)
    {
            NetworkInterface networkInterface = networkInterfaceList.nextElement();
            Log.i("Network Interface Display Name", networkInterface.getDisplayName());
    }

CodePudding user response:

ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
Network[] allNetworks = connectivityManager.getAllNetworks();
for (Network network : allNetworks) {
    LinkProperties linkProperties = connectivityManager.getLinkProperties(network);
    Log.i("Interface: ", linkProperties.getInterfaceName());
}

Check if this works for you, it returns values like "wlan0" or "radio0" for every possible network interface (including wifi).

  • Related