Possible Android hotspot interface names

224 Views Asked by At

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?

1

There are 1 best solutions below

2
Spiros On
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).