Get Wifi Interface name on Android

how to find wireless interface name in windows
networkinterface
check wifi interface name
android networkinterface
what is my network interface name
ubuntu find wireless interface name
how to find my wireless interface
name of your wireless interface

I am currently developing a sort of wifi sniffer. To achieve that I use a tcpdump binary compiled for arm. But it's assume that I know the name of the Wifi Interface.

According to the SDK documentation NetworkInterface provide a getName() method. I plan to use this method, so the first step is to get the NetworkInterface objet corresponding to my wifi interface. To do that I use the WifiInfo to get the ip adress, then get an InetAddress corresponding to this IP and finally get an instance of NetworkInterface by using the static method getByInetAddress(InetAddress address).

Here is my code :

WifiInfo wifiInfo = wifiManager.getConnectionInfo();
int ipAddress = wifiInfo.getIpAddress();
byte[] bytes = BigInteger.valueOf(ipAddress).toByteArray();
InetAddress addr = InetAddress.getByAddress(bytes);
NetworkInterface netInterface = NetworkInterface.getByInetAddress(addr);
Log.e("MyTemp",netInterface.getName());

The output :

SSID: Nancy-Universite, BSSID: 00:19:30:6a:a9:40, MAC: B4:07:F9:D5:7C:8C, Supplicant    state: COMPLETED, RSSI: -80, Link speed: 11, Net ID: 6

But I except something like :

eth0

I also try the isVirtual() method but it doesn't compile, and I get an error message saying the method isVirtual() is not define for the type NetworkInterface. I don't understand what is going on... Any help will be appreciate.

Try this

for(Enumeration<NetworkInterface> list = NetworkInterface.getNetworkInterfaces(); list.hasMoreElements();)
    {
            NetworkInterface i = list.nextElement();
            Log.e("network_interfaces", "display name " + i.getDisplayName());
    }

wireless, Are you sure dummy is a wifi interface? Typical wifi interface's name is wlan0. If that still fails, run the wpa_supplicant command under strace and try get more� If wifi is already enabled I guess I cannot receive that intent. I'm developing an app to create a WiFi direct group and share devices locations between peers. When I open a group I need to initialize a data structure, a map in the form of ( deviceName, lastLocation) with my location.

All you have to do is change

Log.e("MyTemp",netInterface.getName());

to

Log.e("MyTemp",netInterface.getDisplayName());

Android Wifi : How to change network interface used by android , On linux you have iw (show/manipulate wireless devices and their configuration) and when used with the dev command: Commands: dev List all network� Tap on “Wi-Fi Direct”, or launch options menu to see the “Wi-Fi Direct” option (for AOSP) and then tap on it. Now tap on the 3-vertical-dot menu icon to see the “Rename Phone” or “Rename Device” option. Type in the preferred name in the text box and select OK to save it. Change WiFi Direct Name on Android

Use this: String interfaceName = SystemInfo.getInstance().getProperty("wifi.interface");

This will definitely work..

Get Wi-Fi interface device names, All options are already existing under phone settings, I will just be telling you how to dig into it. Editor's Pick: How to Find the IP Address of� Typical wifi interface's name is wlan0. If you're 100% sure it is right wifi interface, you might also need to change the wlan0 inside the wpa_supplicant.conf file. If that still fails, run the wpa_supplicant command under strace and try get more info from there.

You can call /system/ip link and parse the results.

bash-3.2# ip link
ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: usb0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 6e:3d:7a:3a:62:ee brd ff:ff:ff:ff:ff:ff
3: usb1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether da:bb:3f:04:1b:cd brd ff:ff:ff:ff:ff:ff
4: sit0: <NOARP> mtu 1480 qdisc noop state DOWN
    link/sit 0.0.0.0 brd 0.0.0.0
5: ip6tnl0: <NOARP> mtu 1460 qdisc noop state DOWN
    link/tunnel6 :: brd ::
6: ifb0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN qlen 32
    link/ether 76:3c:4e:23:cc:f8 brd ff:ff:ff:ff:ff:ff
7: ifb1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN qlen 32
    link/ether 02:17:54:31:ff:bd brd ff:ff:ff:ff:ff:ff
8: tun: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 500
    link/ether b2:b7:11:da:7c:6a brd ff:ff:ff:ff:ff:ff
16: tiwlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 100
    link/ether 40:fc:89:e4:67:4c brd ff:ff:ff:ff:ff:ff

NetworkInterface, The Google Wifi app lets you set up and control your Google Wifi points or OnHub right from your mobile device. It puts you in control of your network -- easily� How to get the wifi network interface name in java is related to this question but not an exact duplicate. Here I asked specifically about Android and not how to do it in plain Java. The other question is worth reading, but I think you should use specific Android API when they are available as they should be more reliable. – a.b.d Sep 10 '13

Try this:

ls /sys/class/ieee80211/*/device/net/

Non root, tested on Android 4, Android 7.1, Android 9 and Arch Linux.

Change Android Device Name, Get the most accurate device recognition of IP address, MAC address, device name, model, vendor and manufacturer • Advanced device analysis of NetBIOS, � Tap Wi-Fi Direct on the drop-down menu. This will scan your surroundings, and list all devices around you available for a Wi-Fi Direct connection. Depending on your device and current software, the Wi-Fi Direct button may be located at the bottom of your screen on the Wi-Fi page, instead of a drop-down menu.

Change the name of a connected device, information you can get from a network interface is the list of IP addresses that Loopback interface Name: lo InetAddress: /127.0.0.1 Display name: Wireless� Make sure Wi-Fi is turned on. Touch and hold Wi-Fi . At the bottom of the list, tap Add network. You may need to enter the network name (SSID) and security details. Tap Save.

Google Wifi, The interface will vary depending on which version of Android your phone is running. Go to Settings > Network & Internet > Wi-Fi. Tap the SSID (name) of the network you're connected to. A screen appears that displays information about the Wi-Fi connection.

Fing - Network Tools,

Comments
  • It depends on the phone, for me it's eth0, you can run netcfg command via adb to display a network interface list.
  • How to get the wifi network interface name in java is related to this question but not an exact duplicate. Here I asked specifically about Android and not how to do it in plain Java. The other question is worth reading, but I think you should use specific Android API when they are available as they should be more reliable.
  • @a.b.d Were you able to figure out that from all the list of interfaces, how would you differentiate the one for the Wi-Fi ? Would your solution also work when user is offline?
  • From the docs: "On Android, this is the same string as returned by {@link #getName}."
  • This is not available on Android.
  • The value is available via getprop. I'd be interested to know common this is across all devices though. The advantage of this method is that it works when Wi-Fi is off, unlike all the other answers which have their root in what Chloe said.