I am using the following code:
WifiManager wifiMgr = (WifiManager) app.getSystemService(Context.WIFI_SERVICE);
return wifiMgr.getConnectionInfo().getMacAddress();
Problem is, the WIFI must be ENABLED in the device in order for me to read its address. How can I still read the MAC of the WIFI even if the WIFI is off?
MAC addresses are used by devices when connecting to a Wi-Fi network or an access point. Because these MAC addresses are transmitted without encryption, they can be captured and used to potentially track a user's location. Historically, devices use the factory MAC address to associate to a Wi-Fi network.
Yes. For each network interface in your device, there is a unique MAC address associated with it. So if your laptop has both an Ethernet port and Wi-Fi built-in, you will see two MAC addresses in the system configuration.
You can't. Depending on the device, if the wifi adapter is disabled then it may actually be electronically switched off, so you can't read any info from it.
From the Android Developers Blog:
Mac Address
It may be possible to retrieve a Mac address from a device’s WiFi or Bluetooth hardware. We do not recommend using this as a unique identifier. To start with, not all devices have WiFi. Also, if the WiFi is not turned on, the hardware may not report the Mac address.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With