Jhomari Asinas
Jhomari Asinas

Reputation: 11

How can i get the Wi-fi Mac Address of the device that are connected to my hotspot and save it to my database?

I am developing a android app and i want to get the Wi-Fi mac address of the device when connected to the mobile hotspot and save it to my database.

How can I do this?

Upvotes: 0

Views: 90

Answers (1)

Rostech
Rostech

Reputation: 352

After Android 6.0 Changes

To provide users with greater data protection, starting in this release, Android removes programmatic access to the device’s local hardware identifier for apps using the Wi-Fi and Bluetooth APIs. The WifiInfo.getMacAddress() and the BluetoothAdapter.getAddress() methods now return a constant value of 02:00:00:00:00:00.

Before Android 6.0 Changes the MAC address can be received via the WifiManager.

WifiManager manager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiInfo info = manager.getConnectionInfo();
String address = info.getMacAddress();

Upvotes: 1

Related Questions