Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the wifi network interface name in java

How to determine wifi network interface name in java?

like image 748
dheeps Avatar asked Nov 06 '22 05:11

dheeps


1 Answers

Since you said that you are developing on Android use this:

WifiManager wifiManager = (WifiManager) this.getSystemService(WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
System.out.println(wifiInfo.getSSID());

This will return the name of your WIFI.

You have to add this permission to your manifest.

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
like image 172
Niklas Avatar answered Nov 11 '22 04:11

Niklas