-2

I am getting MAC address of devices using wifi interface:

WifiManager wifiMan = (WifiManager) this.getSystemService(
                Context.WIFI_SERVICE);
WifiInfo wifiInf = wifiMan.getConnectionInfo();
String macAddr = wifiInf.getMacAddress();

Is there any way for retrieve mac address without wifi interface?

Also confirm me Can we able to change MAc address of android devices?

Please confirm me android framework support these things or not?

Naveen
  • 21
  • 2
  • 7
  • There are 2 questions here. The first question is a duplicate of http://stackoverflow.com/questions/6191832/get-mac-address-of-android-device-without-wifi The second question is a duplicate of http://stackoverflow.com/questions/5287790/change-wifi-mac-address – rds Apr 23 '12 at 08:09

1 Answers1

0

A MAC address uniquely identifies a network adapter (e.g. WiFi or Bluetooth), so you'll have to access that adapter to retrieve it's MAC address. To get the MAC address of a bluetooth adapter you can use:

BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
if (btAdapter != null) {
    String mac = btAdapter.getAddress();
}

Note that this code requires the android.permission.BLUETOOTH permission and that your code to get the WiFi adapter's MAC requires the android.permission.ACCESS_WIFI_STATE permission. Also, both codes may not work when the adapter is turned off.

There is this post on MAC spoofing (returning a false MAC address) but spoofing can only be done on rooted phones. If you'll google you'll probably find more info on MAC spoofing.

Community
  • 1
  • 1
THelper
  • 15,333
  • 6
  • 64
  • 104